Hi, guys. I just wounder if I could use caching in dev mode.
Cuz i want to debug profile, memory and etc with cache system on.
So here's my example:
_config.php:
SS_Cache::add_backend('primary_memcached', 'Memcached',
array(
'host' => 'localhost', 'port' => 11211,
'persistent' => true, 'weight' => 1,
'timeout' => 5, 'retry_interval' => 15,
'status' => true, 'failure_callback' => ''
)
);
SS_Cache::pick_backend('primary_memcached', 'any', 10);
SS_Cache::pick_backend('default', 'aggregate', 20);
SS_Cache::set_cache_lifetime('primary_memcached', 2000, 1);
SS_Cache::set_cache_lifetime('default', 2000, 2);
heavy template function:
$cache = SS_Cache::factory('primary_memcached');
if (!$records = unserialize($cache->load('222555'))) {
echo "AAAA! "
$records = DataObject::get($obj, $filter, $sort, $join, $limit);
$cache->save(serialize($records),'222555');
}
return $records;
When i see AAA! it means cache isn't works when i don't it's ok.
So I had set cache lifetime, but still it works in live mode only.
UPD: FIXED, just forgot about the other config file