Beispiel #1
0
 public function testCacheMongoFlush()
 {
     // Mongo
     list($ready, $collection) = $this->_prepareMongo();
     if (!$ready) {
         return false;
     }
     $frontCache = new Phalcon\Cache\Frontend\Data(array('lifetime' => 10));
     $cache = new Phalcon\Cache\Backend\Mongo($frontCache, array('mongo' => $ready, 'db' => 'phalcon_test', 'collection' => 'caches'));
     $cache->save('data', "1");
     $cache->save('data2', "2");
     $this->assertTrue($cache->flush());
     $this->assertFalse($cache->exists('data'));
     $this->assertFalse($cache->exists('data2'));
 }
Beispiel #2
0
 public function testCacheMongoFlush()
 {
     $frontCache = new Phalcon\Cache\Frontend\Data(array('lifetime' => 10));
     // Mongo
     $ready = $this->_prepareMongo();
     if (!$ready) {
         return false;
     }
     $mongo = new MongoClient();
     $database = $mongo->phalcon_test;
     $collection = $database->caches;
     $collection->remove();
     $frontCache = new Phalcon\Cache\Frontend\Data();
     $cache = new Phalcon\Cache\Backend\Mongo($frontCache, array('mongo' => $mongo, 'db' => 'phalcon_test', 'collection' => 'caches'));
     $cache->save('data', "1");
     $cache->save('data2', "2");
     $this->assertTrue($cache->flush());
     $this->assertFalse($cache->exists('data'));
     $this->assertFalse($cache->exists('data2'));
 }