Ejemplo n.º 1
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);
     if (is_null($value)) {
         $this->fireCacheEvent('missed', [$key]);
         $value = value($default);
     } else {
         $this->fireCacheEvent('hit', [$key, $value]);
     }
     return $value;
 }
Ejemplo n.º 2
0
 /**
  * Retrieves the data associated with a particular wheel name.
  *
  * @param string $name
  * @return array
  */
 public function getData($name)
 {
     if (!array_key_exists($name, $this->data)) {
         $data = $this->cache->get('flywheel:' . $name);
         if (!$data) {
             $parts = array(0, 0);
         } else {
             $parts = explode(',', $data);
         }
         $this->data[$name] = $parts;
     }
     return $this->data[$name];
 }
Ejemplo 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;
 }
Ejemplo n.º 4
0
 /**
  * Get the unique tag identifier for a given tag.
  *
  * @param  string  $name
  * @return string
  */
 public function tagId($name)
 {
     return $this->store->get($this->tagKey($name)) ?: $this->resetTag($name);
 }
Ejemplo n.º 5
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);
 }
Ejemplo n.º 6
0
 /**
  * @param $key
  * @return mixed
  */
 public function get($key)
 {
     return $this->cache->get($this->key($key));
 }