Ejemplo n.º 1
0
 public function testMongoDecrement()
 {
     list($ready, $collection) = $this->_prepareMongo();
     if (!$ready) {
         return false;
     }
     $frontCache = new Phalcon\Cache\Frontend\Data(array('lifetime' => 200));
     $cache = new Phalcon\Cache\Backend\Mongo($frontCache, array('mongo' => $ready, 'db' => 'phalcon_test', 'collection' => 'caches'));
     $cache->delete('foo');
     $cache->save('foo', 100);
     $this->assertEquals(99, $cache->decrement('foo'));
     $this->assertEquals(89, $cache->decrement('foo', 10));
     $this->assertEquals(89, $cache->get('foo'));
     $this->assertEquals(1, $cache->decrement('foo', 88));
 }