Пример #1
0
 public function testMemcached()
 {
     if (!class_exists('Memcached')) {
         $this->markTestSkipped();
         return;
     }
     $cache = new GitPHP_Cache(new GitPHP_Cache_Memcached(array(array('127.0.0.1', 11211))));
     $cache->Clear();
     $this->assertFalse($cache->Exists('testkey1|testkey2'));
     $cache->Set('testkey1|testkey2', 'testvalue1');
     $this->assertTrue($cache->Exists('testkey1|testkey2'));
     $this->assertEquals('testvalue1', $cache->Get('testkey1|testkey2'));
     $this->assertFalse($cache->Get('testkey3|testkey4'));
     $cache->Set('testkey3|testkey4', 'testvalue2');
     $cache->Delete('testkey1|testkey2');
     $this->assertFalse($cache->Exists('testkey1|testkey2'));
     $this->assertTrue($cache->Exists('testkey3|testkey4'));
     $cache->Clear();
     $this->assertFalse($cache->Exists('testkey3|testkey4'));
 }