Пример #1
0
 function testDrivers()
 {
     $drivers = glob("../lib/plugin/Cache/*.php");
     foreach ($drivers as $drive) {
         if (substr($drive, -9) == 'Cache.php') {
             continue;
         }
         require $drive;
         if (!ActiveMongo_Cache::isDriverActived()) {
             continue;
         }
         ActiveMongo_Cache::flushCache();
         CacheableModel::drop();
         $id = $this->testCacheSimple();
         $vars = $this->testCacheMultiple();
         $this->testUpdateCache($id);
         $this->testFetchFromCache($id);
         $this->testUpdateQueryCache($vars);
     }
 }
Пример #2
0
 /**
  *  Initialize the Cache system, this is done
  *  automatically.
  *
  *  @return void
  */
 public static function Init()
 {
     if (self::$instance) {
         return;
     }
     self::$instance = new ActiveMongo_Cache();
 }
Пример #3
0
            $object[$k] = FALSE;
        }
        return TRUE;
    }
    function setMulti(array $objects, array $ttl)
    {
        $this->memcached->setMulti($objects);
    }
    function get($key, &$object)
    {
        $object = $this->memcached->get($key);
        if (!$object) {
            if ($this->memcached->getResultCode() == Memcached::RES_NOTFOUND) {
                return FALSE;
            }
        }
        return TRUE;
    }
    function set($key, $object, $ttl)
    {
        $this->memcached->set($key, $object, $ttl);
    }
    function delete(array $keys)
    {
        foreach ($keys as $key) {
            $this->memcached->delete($key);
        }
    }
}
ActiveMongo_Cache::setDriver(new MemcachedDriver());