MINI
C:
/
bahan
/
Siak73
/
sparks
/
php-activerecord
/
0.0.2
/
vendor
/
php-activerecord
/
lib
/
cache
/
Upload File:
files >> C:/bahan/Siak73/sparks/php-activerecord/0.0.2/vendor/php-activerecord/lib/cache/Memcache.php
<?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); } } ?>
Copyright ©2021 || Defacer Indonesia