Example #1
0
 /**
  * @param Model $model
  *
  * @return string
  */
 public function toString(Model $model = null)
 {
     Assert::isNotEmpty($this->callback, 'callback can not be empty!');
     $json = parent::toString($model);
     return $this->callback . '(' . $json . ');';
 }
Example #2
0
 public function getById($id, $expires = Cache::EXPIRES_MEDIUM)
 {
     Assert::isScalar($id);
     Assert::isNotEmpty($id);
     if (isset($this->identityMap[$id])) {
         return $this->identityMap[$id];
     }
     return $this->addObjectToMap(Cache::worker($this)->getById($id, $expires));
 }