| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)gepgroup.hk/php-activerecord/lib/cache/ |
Upload File : |
<?php
namespace ActiveRecord;
class Memcache
{
const DEFAULT_PORT = 11211;
private $memcache;
/**
* Creates a Memcache instance.
*
* Takes an $options array w/ the following parameters:
*
* <ul>
* <li><b>host:</b> host for the memcache server </li>
* <li><b>port:</b> port for the memcache server </li>
* </ul>
* @param array $options
*/
public function __construct($options)
{
$this->memcache = new \Memcache();
$options['port'] = isset($options['port']) ? $options['port'] : self::DEFAULT_PORT;
if (!$this->memcache->connect($options['host'],$options['port']))
throw new CacheException("Could not connect to $options[host]:$options[port]");
}
public function flush()
{
$this->memcache->flush();
}
public function read($key)
{
return $this->memcache->get($key);
}
public function write($key, $value, $expire)
{
$this->memcache->set($key,$value,null,$expire);
}
}
?>