private function setGetClean(CacheAbstract $cache) { $base = 'base'; $this->assertTrue($cache->isEnabled()); $cache->setDefaultLifetime(3600); $this->assertEquals(3600, $cache->getDefaultLifetime()); $cache->cleanP($base, 1); try { $data = $cache->getP($base, 1); $this->fail(); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->assertTrue(true); } $retval = $cache->storeP(234, $base, 1); $this->assertTrue($retval); try { $data = $cache->getP($base, 1); $this->assertEquals(234, $data); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->fail(); } sleep(1); try { $data = $cache->getP($base, 1); $this->assertEquals(234, $data); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->fail(); } $cache->cleanP($base, 1); try { $data = $cache->getP($base, 1); $this->fail(); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->assertTrue(true); } // now change again and delete $retval = $cache->storeP(234, $base, 2, 'a'); $this->assertEquals(true, $retval); try { $data = $cache->getP($base, 2, 'a'); $this->assertEquals(234, $data); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->fail(); } $this->assertTrue($cache->deleteP($base, 2, 'a')); // test null $retval = $cache->storeP(null, $base, 3, 'a'); $this->assertEquals(true, $retval); try { $data = $cache->getP($base, 3, 'a'); $this->assertEquals(null, $data); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->fail(); } $this->assertTrue($cache->deleteP($base, 3, 'a')); }