protected function cacheByQuery(SelectQuery $query, $object, $expires = Cache::EXPIRES_FOREVER) { $queryId = $query->getId(); $semKey = $this->keyToInt($this->indexKey); $key = $this->makeQueryKey($query, self::SUFFIX_QUERY); $pool = SemaphorePool::me(); if ($pool->get($semKey)) { $this->syncMap($key); Cache::me()->mark($this->className)->add($key, $object, $expires); $pool->free($semKey); } return $object; }
protected function makeQueryKey(SelectQuery $query, $suffix) { return $this->className . $suffix . $query->getId() . $this->watermark; }