Esempio n. 1
0
 /**
  * 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);
     }
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
 /**
  * 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;
 }
Esempio n. 4
0
 /**
  * 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;
 }
Esempio n. 5
0
 /**
  * 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);
 }
Esempio n. 6
0
 /**
  * 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);
 }
Esempio n. 7
0
 /**
  * Get the cache key prefix.
  *
  * @return string
  */
 public function getPrefix()
 {
     return $this->store->getPrefix();
 }
Esempio n. 8
0
 /**
  * Remove an item from the cache.
  *
  * @param  string $key
  * @return bool
  */
 public function forget($key)
 {
     return $this->store->forget($key);
 }
Esempio n. 9
0
 /**
  *
  */
 public function flush()
 {
     $this->cache->flush();
 }
Esempio n. 10
0
 /**
  * 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;
 }