Cachearium\CacheAbstract::getData PHP 메소드

getData() 공개 메소드

Same as get, but assumes data was stored with a CacheData object and will treat it accordingly.
public getData ( CacheKey $k ) : CacheData
$k CacheKey
리턴 CacheData
    public function getData(CacheKey $k)
    {
        $cd = CacheData::unserialize($this->get($k));
        if ($cd->checkUpdateToDate($this)) {
            return $cd;
        }
        throw new Exceptions\NotCachedException();
    }

Usage Example

예제 #1
0
 protected function _callback(CacheAbstract $cache)
 {
     $base = 'callback';
     $key1 = new CacheKey($base, 1);
     $cache->clean($key1);
     $this->assertEquals(CALLBACKVALUE, $cache->startCallback($key1, 'callbackTester'));
     try {
         $data = $cache->getData($key1);
         $this->assertEquals(CALLBACKVALUE, $data->stringify($cache));
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->fail();
     }
 }
All Usage Examples Of Cachearium\CacheAbstract::getData