[+] добавлен мемкэш

This commit is contained in:
rsgrinko committed 2021-12-10 17:48:33 +03:00
1 parent 8228fae384
commit 0bf9cfdc75
1 file changed
+30
+30
View File
@@ -192,6 +192,36 @@ class CCache
{
return (time() - @filectime(self::$cache_dir . md5($name) . '.tmp'));
}
/**
* Тестовый метод для записи в мемкэш
* TODO: переделать
*/
public static function memcacheWrite($name, $value):bool {
$memcache = memcache_connect('localhost', 11211);
if ($memcache) {
$memcache->set($name, serialize($value));
return true;
} else {
return false;
}
}
/**
* Тестовый метод для чтения из мемкэша
* TODO: переделать
*/
public static function memcacheGet($name) {
$memcache = memcache_connect('localhost', 11211);
if ($memcache) {
return $memcache->get($name);
} else {
return false;
}
}
}
?>