/** * Store an item in the cache. * * @param string $key * @param mixed $value * @param \DateTime|int $minutes * @return void */ public function put($key, $value, $minutes) { $minutes = $this->getMinutes($minutes); if (!is_null($minutes)) { $this->store->put($key, $value, $minutes); } }
/** * Increments the number of calls on the flywheel. * * @param $name * @param $interval * @return $this */ public function incrementCalls($name, $interval) { $calls = 1 + $this->getCalls($name, $interval); $time = microtime(true); $this->data[$name] = array($calls, $time); $this->cache->put('flywheel:' . $name, implode(',', $this->data[$name]), ceil($interval / 60)); return $this; }
/** * Get the unique section identifier. * * @return string */ protected function sectionId() { $id = $this->store->get($this->sectionKey()); if (is_null($id)) { $id = $this->reset(); } return $id; }
/** * Reset the tag and return the new tag identifier * * @param string $name * @return string */ public function resetTag($name) { $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true))); return $id; }
/** * Store an item in the cache. * * @param string $key * @param mixed $value * @param \DateTime|int $minutes * @return void */ public function put($key, $value, $minutes) { $minutes = $this->getMinutes($minutes); $this->store->put($key, $value, $minutes); }
/** * Retrieve an item from the cache by key. * * @param string $key * @param mixed $default * @return mixed */ public function get($key, $default = null) { $value = $this->store->get($key); return !is_null($value) ? $value : value($default); }
/** * Get the cache key prefix. * * @return string */ public function getPrefix() { return $this->store->getPrefix(); }
/** * Remove an item from the cache. * * @param string $key * @return bool */ public function forget($key) { return $this->store->forget($key); }
/** * */ public function flush() { $this->cache->flush(); }
/** * Reset the tag and return the new tag identifier * * @param string $name * @return string */ public function resetTag($name) { $this->store->forever($this->tagKey($name), $id = uniqid()); return $id; }
/** * Remove an item from the cache. * * @param string $key * @return bool */ public function forget($key) { $success = $this->store->forget($key); $this->fireCacheEvent('delete', [$key]); return $success; }