/** * Store an item in the cache for a given number of minutes. * * @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($this->taggedItemKey($key), $value, $minutes); } }
/** * Store the cache. * * @return void */ public function save() { $contents = $this->getForStorage(); if ($this->ttl !== null) { $this->client->put($this->key, $contents, $this->ttl); } else { $this->client->forever($this->key, $contents); } }
/** * {@inheritdoc} */ protected function storeItemInCache(CacheItemInterface $item, $ttl) { if ($ttl < 0) { return false; } $ttl = null === $ttl ? 0 : $ttl / 60; if (null === ($value = $item->get())) { $value = self::NULL_VALUE; } $this->store->put($item->getKey(), $value, $ttl); return true; }
/** * 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); $this->fireCacheEvent('write', [$key, $value, $minutes]); } }
/** * Store an item in the cache. * * @param string $key * @param mixed $value * @param \DateTime|int $minutes * @return void */ public function put($key, $value, $minutes = null) { if (is_array($key) && filter_var($value, FILTER_VALIDATE_INT) !== false) { return $this->putMany($key, $value); } $minutes = $this->getMinutes($minutes); if (!is_null($minutes)) { $this->store->put($this->itemKey($key), $value, $minutes); $this->fireCacheEvent('write', [$key, $value, $minutes]); } }
/** * Store an item in the cache. * * @param string $key * @param mixed $value * @param \DateTime|float|int $minutes * @return void */ public function put($key, $value, $minutes = null) { if (is_array($key)) { return $this->putMany($key, $value); } $minutes = $this->getMinutes($minutes); if (!is_null($minutes)) { $this->store->put($this->itemKey($key), $value, $minutes); $this->fireCacheEvent('write', [$key, $value, $minutes]); } }
/** * Determine if the user has too many failed login attempts. * @param Request $request * @return bool */ protected function hasTooManyLoginAttempts(Request $request, Cache $cache) { $attempts = $this->loginAttempts($request); $lockedOut = $cache->has($key = $this->loginLockExpirationKey($request)); if ($attempts > $this->maxLoginAttempts() || $lockedOut) { if (!$lockedOut) { $minutes = round($this->lockOutTimemout() / 60); $cache->put($key, time() + $minutes * 60, $minutes); } return true; } return false; }
/** * {@inheritdoc} */ public function store($key, $value, $ttl = 0) { $this->cache->put($key, $value, floatval($ttl) / 60); // Return false if the store was unsuccessful return $this->contains($key); }
/** * Clear the throttle. * * @return $this */ public function clear() { $this->number = 0; $this->store->put($this->key, $this->number, $this->time); return $this; }
/** * Put an item into the cache store * * @param string $key * @param mixed $content * @param integer $minutes * @return void */ public function put($key, $content, $minutes) { $this->store->put($key, $content, $minutes); }
/** * Put an item into the cache store * * @param string $locale * @param string $group * @param string $namespace * @param mixed $content * @param integer $minutes * @return void */ public function put($locale, $group, $namespace, $content, $minutes) { $key = $this->getKey($locale, $group, $namespace); $this->store->put($key, $content, $minutes); }