Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Tweak memcache initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 27, 2014
1 parent 342a576 commit 4b72160
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function preDispatch()
if(!$this->isDebug())
{
$frontendOptions = array('automatic_serialization' => true, 'lifetime' => 86400);
if(extension_loaded('memcache'))
if(extension_loaded('memcache') || session_save_path() === 'Memcache')
{
$cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, array());
}
Expand All @@ -128,7 +128,7 @@ public function preDispatch()
else
{
$cacheDir = UtilityComponent::getCacheDirectory() . '/db';
if(is_writable($cacheDir))
if(is_dir($cacheDir) && is_writable($cacheDir))
{
$backendOptions = array('cache_dir' => $cacheDir);
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend/Libmemcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Zend_Cache_Backend_Libmemcached extends Zend_Cache_Backend implements Zend
*/
public function __construct(array $options = array())
{
if (!extension_loaded('memcached')) {
if (!extension_loaded('memcached') || session_save_path() !== 'Memcache') {
Zend_Cache::throwException('The memcached extension must be loaded for using this backend !');
}

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
*/
public function __construct(array $options = array())
{
if (!extension_loaded('memcache')) {
if (!extension_loaded('memcache') || session_save_path() !== 'Memcache') {
Zend_Cache::throwException('The memcache extension must be loaded for using this backend !');
}
parent::__construct($options);
Expand Down

0 comments on commit 4b72160

Please sign in to comment.