Microweber\Utils\Adapters\Cache\Storage\FileStorage::put PHP Method

put() public method

Store an item in the cache for a given number of minutes.
public put ( string $key, mixed $value, integer $minutes )
$key string
$value mixed
$minutes integer
    public function put($key, $value, $minutes)
    {
        $key = $this->appendLocale($key);
        $this->memory[$key] = $value;
        $value = $this->expiration($minutes) . serialize($value);
        $path = $this->path($key);
        $path = $this->normalize_path($path, false);
        $this->createCacheDirectory($path);
        $skip = false;
        if (!empty($this->tags)) {
            foreach ($this->tags as $tag) {
                if (in_array($tag, $this->deleted_tags)) {
                    $skip = true;
                }
            }
            $this->_setTags($path);
        }
        if (!$skip) {
            @file_put_contents($path, $value);
        }
        // $this->files->put($path, $value);
    }

Usage Example

Beispiel #1
0
 /**
  * Store an item in the cache for a given number of minutes.
  *
  * @param  string $key
  * @param  mixed  $value
  * @param  int    $minutes
  *
  * @return void
  */
 public function put($key, $value, $minutes)
 {
     return $this->adapter->put($key, $value, $minutes);
 }