首页 \ 问答 \ Zend_Cache从命令行保存并从浏览器访问(Zend_Cache save from command line and access from browser)

Zend_Cache从命令行保存并从浏览器访问(Zend_Cache save from command line and access from browser)

可能是我这是超级简单,但我不能'弄清楚方式。 我有脚本运行在命令行中使用Zend_Cache保存缓存

$frontendOptions = array(
            'lifetime' => NULL,
            'automatic_serialization' => true
        );

$backendOptions = array(
            'cache_dir' => "/home/tmp/cache"
        );

$cache = Zend_Cache::factory('Core',
                    'File',
                    $frontendOptions,
                    $backendOptions);
$vars = Array("id1" => "12121", "id2" => "2232");
$cache->save($vars, "p_11");

我可以从命令行访问已保存的缓存:

$cache->load("p_11");

在上述两种情况下,我都有使用php-cli在命令行中运行的app.php文件。

现在,我想使用浏览器访问p_11缓存,如http://mytestserve.lan/test_cache.php

我用上面的缓存工厂创建了对象。 所有参数与上面相同。 但是,当我尝试加载缓存p_11时,我没有从命令行设置变量。 什么地方出了错?


May be I am this is super-easy but I couldnt' figure out way. I have script running in command line which save cache using Zend_Cache

$frontendOptions = array(
            'lifetime' => NULL,
            'automatic_serialization' => true
        );

$backendOptions = array(
            'cache_dir' => "/home/tmp/cache"
        );

$cache = Zend_Cache::factory('Core',
                    'File',
                    $frontendOptions,
                    $backendOptions);
$vars = Array("id1" => "12121", "id2" => "2232");
$cache->save($vars, "p_11");

I can access saved cache from command line:

$cache->load("p_11");

In above both case, I have app.php file that run in command line using php-cli.

Now, I want to access p_11 cache using browser something like http://mytestserve.lan/test_cache.php

I have create object with cache factory like above. All the parameters are same as above. However when I try to load cache p_11, i do not variables set from command line. What went wrong?


原文:https://stackoverflow.com/questions/12455343
更新时间:2022-01-31 22:01

最满意答案

为了解决调试问题,而不是在框架中进行基于步骤的调试,在Django社区中更好的是提供单元测试。 如果你正在构建一个模块, Django提供了测试应用程序的工具 。 对于逐步调试,您可能需要一个IDE来处理它:AFAIK Django不提供这种功能。


To address debugging, instead of step-based debugging in the framework itself it is more preferable in the Django community to provide unit tests. If you are building a module, Django provides facilities to test applications. For step-through debugging you may need an IDE to handle it: AFAIK Django doesn't provide a facility to do that.

相关问答

更多
  • 您的代码在Chrome中有效(带有浏览器前缀)。 我只是不确定它是否符合您的意图...... 步启动 此关键字表示计时功能步骤(1,开始)。 使用此计时功能, 动画立即跳转到结束状态并保持在该位置直到动画结束。 资源 这意味着您的动画会直接跳到最后一帧并错过所有中间位置。 你确定这是你想要的效果吗? 这是一个演示,表明您的动画正在运行 。 查看文本如何立即改变颜色。 更改计时功能以ease和定位动画的工作原理。 演示 Your code does work in Chrome (with browser p ...
  • 这是你要问的吗? $(".a").fadeIn(3000,function(){ $(".b").fadeIn(3000, function(){ $(".c").fadeIn(3000); }); }); is this is what you were asking? $(".a").fadeIn(3000,function(){ $(".b").fadeIn(3000, function(){ $(".c").fadeIn(3000); ...
  • 顺序是[Lin]N[Rin]并且预订是N[Lpr][Rpr] 。 该函数从Preorder中选择第一个节点N,并在N之后从Inorder列表(借助于预订)和右序列从Inorder列表(借助预订)构造左子子。 此代码通过具有以下终止条件的递归来实现此目的 if(num==1)/*if only one node in tree*/ return temp; 关于你不明白的一步 for(j=1;j<=i+1;j++) preptr=preptr->next; 将preptr提前超过N和[Lpr],并 ...
  • 为了解决调试问题,而不是在框架中进行基于步骤的调试,在Django社区中更好的是提供单元测试。 如果你正在构建一个模块, Django提供了测试应用程序的工具 。 对于逐步调试,您可能需要一个IDE来处理它:AFAIK Django不提供这种功能。 To address debugging, instead of step-based debugging in the framework itself it is more preferable in the Django community to prov ...
  • var GetCharData = function() { var queue = [], running = false, next = function() { running = false; if (queue.length) GetCharData(queue.shift()); }; return function(me) { if (running) return ...
  • EXECUTABLE选项应定义如何在代码上运行某些内容并生成覆盖率数据。 例如,它应该是运行所有测试的指令。 如果您使用ctest定义了测试,请尝试如下所示: SETUP_TARGET_FOR_COVERAGE(NAME coverage EXECUTABLE ctest) (或ctest --parallel n如果你有很多测试和多个处理器!)如果你有一个特定的目标来运行一些测试,然后尝试像这样: SETUP_TARGET_FOR_COVERAGE( ...
  • django-registration实际上很容易上手,虽然取决于你正在看哪些文档,它看起来有点压倒性。 你在看快速入门指南吗? 您真正需要做的就是安装它,为您的设置和urls.py各添加一行,并制作一些模板。 我认为可能有更好的示例模板,但这里是我的旧项目的模板。 该项目使用了在原始注册表单中放置配置文件信息的方法,这意味着制作一个简单的RegistrationForm子类 ,进行小型注册后端 ,并将其黑客入注册注册网址 。 (现在可能有更好的方法来做到这一点;我最初在4年前写过这篇文章并且在2年内没有触 ...
  • 在OPENSHIFT中创建的步骤 1.创建项目: 在openshift中创建一个python2.7应用程序 创建一个sshkey ssh-keygen -t rsa并上传publickey cat ~/.ssh/id_rsa.pub 2.克隆项目: 克隆应用程序。(即git clone ssh://52fb16fa4382..@n-suhail.rhcloud.com/~/git/n.git/ ) 现在创建一个文件夹,其中包含files : requirements.txt , setup.py和wsgi. ...
  • 之所以这么慢是因为Python的for循环非常慢,特别是当它们与FORTRAN循环相比时(这就是PyMC基本上编写的内容)。如果你能展示更详细的代码,那么你可能更容易看到它正在努力做到并提供更快的替代算法。 Actually I found a 'crazy' solution, and I have the suspect to know why it works. I would still like to get an expert opinion on my trick. Basically if ...
  • 您正在将display值更新为quicky。 如果添加超时,您将看到图像实际显示然后隐藏。 更改不直接呈现(请参阅@ Maximus的答案) 添加超时,它将按您的意愿工作 $(function() { $(".button1").on("click", function() { $(".img").css("display", "block"); $(".bord").append('
    11111111
    '); set ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)