Вход Регистрация
Файл: adultscript-2.0.3-pro/files/libraries/framework/cache/memcache.php
Строк: 33
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VCache_Driver_memcache extends VCache
{
    private 
$db;
    private 
$compress;
    private 
$persistent;
    public function 
__construct()
    {
        
parent::__construct();
        
$this->db             = new Memcache;
        
$this->compress     = ($this->memcache_compression === 1) ? MEMCACHE_COMPRESSED 0;
        
$this->persistent     = ($this->memcache_persistent === 1) ? TRUE FALSE;
        foreach (
$this->memcache_servers as $server) {
            
$this->db->addServer($server['host'], $server['port'], $this->persistent);
        }
    }

    public function 
get($cache_id$expire=NULL)
    {
        return 
$this->db->get($this->get_key($cache_id));
    }

    public function 
store($cache_id$data$expire=NULL)
    {
        
$expire = ($expire) ? ($expire*60) : $this->lifetime;
        return 
$this->db->set($this->get_key($cache_id), $data$this->compress$expire);
    }

    public function 
remove($cache_id)
    {
        return 
$this->db->delete($this->get_key($cache_id));
    }

    public function 
gc()
    {
        return 
TRUE;
    }
    
    public function 
clear()
    {
        
$this->db->flush();
    }

    public function 
test()
    {
        return (
extension_loaded('memcache') && class_exists('Memcache'));
    }
}
?>
Онлайн: 1
Реклама