21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1121 Views |
-
Cache

22 April 2011 at 11:06am Last edited: 22 April 2011 11:31am
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
-
Re: Cache

6 March 2013 at 3:05pm
Hi, I'm having issues with setting up memcached in silverstripe. What other config file did you update and do you know how to get silverstripe to use memcached for the template cacheing... I'm still getting a lot of files written to silverstripe-cache directory?
my _config has
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);
| 1121 Views | ||
|
Page:
1
|
Go to Top |


