Skip to content
Snippets Groups Projects
Commit 1282c9f5 authored by llaffont's avatar llaffont
Browse files

Ajout du backend memcached sur option dans config.ini

memcached.enable = 1
memcached.host = localhost
memcached.port = 11211
parent df81c9e5
No related merge requests found
......@@ -125,19 +125,23 @@ function loadConfig() {
function setupCache($cfg) {
$frontendOptions = array(
'lifetime' => 3600, // durée du cache: 1h
'automatic_serialization' => false,
'caching' => true);
// 'caching' => $cfg->get('caching'));
$frontendOptions = [
'lifetime' => 3600, // durée du cache: 1h
'automatic_serialization' => false,
'caching' => true];
$backendOptions = array(
'cache_dir' => PATH_TEMP // Directory where to put the cache files
);
$use_memcached = (isset($cfg->memcached->enable) && ('1' == $cfg->memcached->enable));
$backendOptions = $use_memcached
? ['servers' => [ ['host' => $cfg->memcached->host,
'port' => $cfg->memcached->port] ]]
: ['cache_dir' => PATH_TEMP ];
// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core',
'File',
$use_memcached ? 'Memcached' : 'File',
$frontendOptions,
$backendOptions);
// $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment