src/Directory.php
/**
     * Saves data to the cache.
     *
     * @param  mixed $data The data to cache.
     * @param  string $key The cache id to save.
     * @param  array $tags The cache tags for this cache entry.
     * @param  int $ttl The time-to-live in seconds, if set to null the
     *                       cache is valid forever.
     * @return boolean Returns True on success or False on failure.
     */
Saves data to the cache.
@param  mixed $data The data to cache.
@param  string $key The cache id to save.
@param  array $tags The cache tags for this cache entry.
@param  int $ttl The time-to-live in seconds, if set to null the
cache is valid forever.
@return boolean Returns True on success or False on failure.
Saves data to the cache . @param mixed $data The data to cache . @param string $key The cache id to save . @param array $tags The cache tags for this cache entry . @param int $ttl The time - to - live in seconds if set to null the cache is valid forever . @return boolean Returns True on success or False on failure .
public function save($data, $key, array $tags = null, $ttl = null)
    {
        $key = $this->mapKey($key);
        $path = $this->getKeyPath($key);
        $this->buildPath(dirname($path));
        file_put_contents($path, serialize($data), $this->getOption('locking') ? LOCK_EX : null);
        if (null !== $tags) {
            foreach ($tags as $tag) {
                $ids = $this->loadTag($tag);
                $ids[] = $key;
                $this->saveTag($tag, $ids);
            }
        }
        if (null !== $ttl) {
            $this->saveExpire($key, $ttl);
        } else {
            $this->saveExpire($key, false);
        }
        return true;
    }
public function save ( $ data , $ key , array $ tags = null , $ ttl = null ) { $ key = $ this -> mapKey ( $ key ) ; $ path = $ this -> getKeyPath ( $ key ) ; $ this -> buildPath ( dirname ( $ path ) ) ; file_put_contents ( $ path , serialize ( $ data ) , $ this -> getOption ( 'locking' ) ? LOCK_EX : null ) ; if ( null !== $ tags ) { foreach ( $ tags as $ tag ) { $ ids = $ this -> loadTag ( $ tag ) ; $ ids [ ] = $ key ; $ this -> saveTag ( $ tag , $ ids ) ; } } if ( null !== $ ttl ) { $ this -> saveExpire ( $ key , $ ttl ) ; } else { $ this -> saveExpire ( $ key , false ) ; } return true ; }
Saves data to the cache.
Saves data to the cache .