mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
Merge pull request #542 from IT-Experte/master
Fixed using wrong get and set methods from class memcached
This commit is contained in:
@@ -42,18 +42,12 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
|
|||||||
*/
|
*/
|
||||||
protected function read(array $keys)
|
protected function read(array $keys)
|
||||||
{
|
{
|
||||||
$_keys = $lookup = array();
|
$res = array();
|
||||||
foreach ($keys as $k) {
|
foreach ($keys as $key) {
|
||||||
$_k = sha1($k);
|
$k = sha1($key);
|
||||||
$_keys[] = $_k;
|
$res[$key] = $this->memcache->get($k);
|
||||||
$lookup[ $_k ] = $k;
|
|
||||||
}
|
}
|
||||||
$_res = array();
|
return $res;
|
||||||
$res = $this->memcache->get($_keys);
|
|
||||||
foreach ($res as $k => $v) {
|
|
||||||
$_res[ $lookup[ $k ] ] = $v;
|
|
||||||
}
|
|
||||||
return $_res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +62,11 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
|
|||||||
{
|
{
|
||||||
foreach ($keys as $k => $v) {
|
foreach ($keys as $k => $v) {
|
||||||
$k = sha1($k);
|
$k = sha1($k);
|
||||||
$this->memcache->set($k, $v, 0, $expire);
|
if (class_exists('Memcached')) {
|
||||||
|
$this->memcache->set($k, $v, $expire);
|
||||||
|
} else {
|
||||||
|
$this->memcache->set($k, $v, 0, $expire);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user