get() public method

public get ( )
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function get()
 {
     parent::get();
     if (is_array($this->data) && array_key_exists(static::DATA_FIELD, $this->data) && array_key_exists(static::TAGS_FIELD, $this->data)) {
         $this->tags = array_keys($this->data[static::TAGS_FIELD]);
         $this->data = $this->data[static::DATA_FIELD];
     }
     return $this->data;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function get($invalidation = 0, $arg = null, $arg2 = null)
 {
     $result = parent::get($invalidation, $arg, $arg2);
     if (isset($this->tracker)) {
         $miss = $this->isMiss();
         $key = $this->getKey();
         $this->tracker->trackRequest($key, !$miss, $result);
     }
     return $result;
 }
Example #3
0
 public function testGet()
 {
     $item = new Item();
     $poolStub = new PoolGetDriverStub();
     $poolStub->setDriver(new DriverExceptionStub());
     $item->setPool($poolStub);
     $item->setKey(array('path', 'to', 'get'));
     $this->assertFalse($item->isDisabled());
     $this->assertNull($item->get());
     $this->assertTrue($item->isDisabled(), 'Is disabled after exception is thrown in driver');
 }
Example #4
0
 public function testKeyCollisions2()
 {
     $driver = new $this->driverClass();
     $poolStub = new PoolGetDriverStub();
     $poolStub->setDriver($driver);
     $item1 = new Item();
     $item1->setPool($poolStub);
     $item1->setKey(array('#'));
     $item1->set('X');
     $item2 = new Item();
     $item2->setPool($poolStub);
     $item2->setKey(array(':'));
     $item2->set('Y');
     $this->assertEquals('X', $item1->get());
 }
 private function assertDisabledStash(Item $stash)
 {
     $this->assertFalse($stash->set('true'), 'storeData returns false for disabled cache');
     $this->assertNull($stash->get(), 'getData returns null for disabled cache');
     $this->assertFalse($stash->clear(), 'clear returns false for disabled cache');
     $this->assertTrue($stash->isMiss(), 'isMiss returns true for disabled cache');
     $this->assertFalse($stash->extendCache(), 'extendCache returns false for disabled cache');
     $this->assertTrue($stash->lock(100), 'lock returns true for disabled cache');
 }