Zend_Cache save from command line and access from browser

Posted by Krishna Sunuwar on Stack Overflow See other posts from Stack Overflow or by Krishna Sunuwar
Published on 2012-09-17T08:10:46Z Indexed on 2012/09/17 9:37 UTC
Read the original article Hit count: 276

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework