Beispiel #1
0
 public function testGet()
 {
     $memcache = $this->getMemcache();
     $item = new MemcacheItem();
     $item->setKey('foo');
     $item->setValue(23);
     $memcache->saveItem($item);
     $item = $memcache->getItem('foo');
     $this->assertInstanceOf(CacheItem::class, $item);
     $this->assertTrue($item->isHit());
     $this->assertEquals(23, $item->getValue());
 }
Beispiel #2
0
 /**
  * @param string $key
  *
  * @return MemcacheItem
  */
 public function getItem(string $key)
 {
     $item = new MemcacheItem();
     $item->setStorage($this);
     $item->setKey($key);
     return $item;
 }