[-] Classes : fix memcache ext #PSCFV-5225 thanks @up2date
This commit is contained in:
Vendored
+16
-7
@@ -44,11 +44,19 @@ class CacheMemcacheCore extends Cache
|
|||||||
{
|
{
|
||||||
$this->connect();
|
$this->connect();
|
||||||
|
|
||||||
// Get keys (this code comes from Doctrine 2 project)
|
|
||||||
$this->keys = array();
|
$this->keys = array();
|
||||||
$servers = self::getMemcachedServers();
|
$servers = self::getMemcachedServers();
|
||||||
|
|
||||||
if(is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats'))
|
if(is_array($servers) && count($servers) > 0)
|
||||||
|
{
|
||||||
|
$this->keys = $this->memcache->get(_COOKIE_IV_);
|
||||||
|
if (!is_array($this->keys))
|
||||||
|
$this->keys = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Get keys (this code comes from Doctrine 2 project)
|
||||||
|
if(is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats'))
|
||||||
$all_slabs = $this->memcache->getStats('slabs');
|
$all_slabs = $this->memcache->getStats('slabs');
|
||||||
|
|
||||||
if(isset($all_slabs) && is_array($all_slabs))
|
if(isset($all_slabs) && is_array($all_slabs))
|
||||||
@@ -56,11 +64,11 @@ class CacheMemcacheCore extends Cache
|
|||||||
{
|
{
|
||||||
if (is_array($slabs))
|
if (is_array($slabs))
|
||||||
{
|
{
|
||||||
foreach (array_keys($slabs) as $slab_id)
|
foreach (array_keys($slabs) as $i => $slab_id) // $slab_id is not an int but a string, using the key instead ?
|
||||||
{
|
{
|
||||||
if(is_int($slab_id))
|
if(is_int($i))
|
||||||
{
|
{
|
||||||
$dump = $this->memcache->getStats('cachedump', (int)$slab_id);
|
$dump = $this->memcache->getStats('cachedump', (int)$i);
|
||||||
if ($dump)
|
if ($dump)
|
||||||
{
|
{
|
||||||
foreach ($dump as $entries)
|
foreach ($dump as $entries)
|
||||||
@@ -73,7 +81,7 @@ class CacheMemcacheCore extends Cache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
@@ -145,6 +153,7 @@ class CacheMemcacheCore extends Cache
|
|||||||
*/
|
*/
|
||||||
protected function _writeKeys()
|
protected function _writeKeys()
|
||||||
{
|
{
|
||||||
|
$this->memcache->set(_COOKIE_IV_, $this->keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user