New to Phalcon and need some help in using Phalcon\Cache and Phalcon\Cache\Backend\Apc.
1) Phalcon\Cache\Backend\Apc - What does the "prefix" option actually do? Even though I create a cache with prefix set to 'cache', I am still able to just use the key without the prefix to get data from cache.
2) What is the "tracking" option for and does it apply to Backend\Apc? This option is not documented anywhere, but was in the code example for Memcached on GitHub incubator.
3) Where exactly should the cache code be if global, static data needs to be cached? Should it be under dependency injector in services.php? I want to read a static catalog (e.g restaurant menu) once a day from the database and have it cached for all users to access. Currently, I have something like this:
$di->set('mydailyrefreshcache', function() {
$frontendcache = new Phalcon\Cache\Frontend\Data ....
$cache = new Phalcon\Cache\Backend\Apc ($frontendcache, array(
'prefix' => 'cache'
));
if (!$cache->exists('my-key')) {
$arr = Catalog::find();
$cache->save('my-key', $arr);
}
});
Thanks for the help!