Example #1
0
 public function testKeysGeneratorFailsWhenNotIterable()
 {
     $backend = $this->getMockBuilder('Cachet\\Backend')->getMockForAbstractClass();
     $cache = new \Cachet\Cache('cache', $backend);
     $this->setExpectedException('RuntimeException', "This backend does not support iteration");
     $keys = iterator_to_array($cache->keys());
 }
Example #2
0
<?php

require __DIR__ . '/../src/Cachet.php';
Cachet::register();
$pdo = new Cachet\Backend\PDO(function () {
    return new PDO('sqlite:/tmp/db.sqlite');
});
$cachet = new Cachet\Cache('cache', $pdo);
echo $cachet->increment('foo');