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
最满意答案
为了解决调试问题,而不是在框架中进行基于步骤的调试,在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.
相关问答
更多-
动画位置一步一步(Animate position step by step)[2024-05-02]
您的代码在Chrome中有效(带有浏览器前缀)。 我只是不确定它是否符合您的意图...... 步启动 此关键字表示计时功能步骤(1,开始)。 使用此计时功能, 动画立即跳转到结束状态并保持在该位置直到动画结束。 资源 这意味着您的动画会直接跳到最后一帧并错过所有中间位置。 你确定这是你想要的效果吗? 这是一个演示,表明您的动画正在运行 。 查看文本如何立即改变颜色。 更改计时功能以ease和定位动画的工作原理。 演示 Your code does work in Chrome (with browser p ... -
jQuery一步一步的动画(jQuery step by step animation)[2021-04-14]
这是你要问的吗? $(".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 step through the code)[2024-02-21]
为了解决调试问题,而不是在框架中进行基于步骤的调试,在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 ... -
Ajax请求一步一步(Ajax request step by step)[2023-05-16]
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上使用python 27配置Django1.6一步一步(Configure Django1.6 with python 27 on openshift Step by step)[2022-09-20]
在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. ... -
PyMC:一步一步抽样?(PyMC: sampling step by step?)[2023-08-13]
之所以这么慢是因为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 ...