Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Passing correct options variable to the Doctrine Cache Driver
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecquet committed Mar 22, 2016
1 parent 5251a2c commit 9fb59d1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions core/src/plugins/cache.doctrine/class.DoctrineCacheDriver.php
Expand Up @@ -70,35 +70,35 @@ public function init($options)
AJXP_Logger::error(__CLASS__, "init", "The APC extension package must be installed!");
return;
}
$this->_apc_init();
$this->_apc_init($driverOptions);
break;
case "memcache":
if (!MEMCACHE_EXTENSION_LOADED) {
AJXP_Logger::error(__CLASS__, "init", "The Memcache extension package must be installed!");
return;
}
$this->_memcache_init();
$this->_memcache_init($driverOptions);
break;
case "memcached":
if (!MEMCACHED_EXTENSION_LOADED) {
AJXP_Logger::error(__CLASS__, "init", "The Memcached extension package must be installed!");
return;
}
$this->_memcached_init();
$this->_memcached_init($driverOptions);
break;
case "redis":
if (!REDIS_EXTENSION_LOADED) {
AJXP_Logger::error(__CLASS__, "init", "The Redis extension package must be installed!");
return;
}
$this->_redis_init();
$this->_redis_init($driverOptions);
break;
case "xcache":
if (!XCACHE_EXTENSION_LOADED) {
AJXP_Logger::error(__CLASS__, "init", "The XCache extension package must be installed!");
return;
}
$this->_xcache_init();
$this->_xcache_init($driverOptions);
break;
default:
break;
Expand All @@ -110,41 +110,41 @@ public function init($options)
}
}

public function _apc_init() {
public function _apc_init($options) {
$this->cacheDriver = new Cache\ApcCache();
}

public function _memcache_init() {
public function _memcache_init($options) {
$memcache = new Memcache();
@$running = $memcache->connect($this->options['MEMCACHE_HOSTNAME'], $this->options['MEMCACHE_PORT']);
@$running = $memcache->connect($options['MEMCACHE_HOSTNAME'], $options['MEMCACHE_PORT']);

if (! $running) return;

$this->cacheDriver = new Cache\MemcacheCache();
$this->cacheDriver->setMemcache($memcache);
}

public function _memcached_init() {
public function _memcached_init($options) {
$memcached = new Memcached();
@$running = $memcached->addServer($this->options['MEMCACHED_HOSTNAME'], $this->options['MEMCACHED_PORT']);
@$running = $memcached->addServer($options['MEMCACHED_HOSTNAME'], $options['MEMCACHED_PORT']);

if (! $running) return;

$this->cacheDriver = new Cache\MemcachedCache();
$this->cacheDriver->setMemcached($memcached);
}

public function _redis_init() {
public function _redis_init($options) {
$redis = new Redis();
@$running = $redis->connect($this->options['REDIS_HOSTNAME'], $this->options['REDIS_PORT']);
@$running = $redis->connect($options['REDIS_HOSTNAME'], $options['REDIS_PORT']);

if (! $running) return;

$this->cacheDriver = new \Doctrine\Common\Cache\RedisCache();
$this->cacheDriver->setRedis($redis);
}

public function _xcache_init() {
public function _xcache_init($options) {
$this->cacheDriver = new Cache\XcacheCache();
}

Expand Down

0 comments on commit 9fb59d1

Please sign in to comment.