/** * @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 . ');'; }
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)); }