Commit 8ced1ffd authored by Alex Ne's avatar Alex Ne

Кэширование Memcache

parent 2500c05d
<?php
namespace X\Memcache;
class Cache extends \Memcache
{
protected $compression = false;
protected $prefix;
protected $connect = false;
function __construct( $prefix, $host = "localhost", $port = 11211, $compression = false )
{
$this->prefix = $prefix;
$this->compression = $compression;
if( $this->connect($host,$port) ) $this->connect = true;
}
public function set( $key, $value, $expire = 240 )
{
$key = $this->prefix ."-". $key;
return parent::set( $key , $value, $this->compression, $expire);
}
public function get($key)
{
$key = $this->prefix ."-". $key;
return parent::get($key, $this->compression);
}
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment