public function save($data, $id, $tags = array(), $specificLifetime = false)
    {
        if(!is_array($tags)) $tags = array($tags);

        $lifetime = $this->getLifetime($specificLifetime);

        $oldTags = explode(
            ',', $this->getRediska()->getFromHash(
                $this->_options['storage']['prefix_key'].$id, self::FIELD_TAGS
            )
        );

        $this->_getTransactionByKey($this->_options['storage']['prefix_key'].$id)
            ->setToHash(
                $this->_options['storage']['prefix_key'].$id,  array(
                self::FIELD_DATA => $data,
                self::FIELD_TAGS => implode(',',$tags),
                self::FIELD_MTIME => time(),
                self::FIELD_INF => $lifetime ? 0 : 1)
            );
        $this->_getTransactionByKey($this->_options['storage']['prefix_key'].$id)
            ->expire($this->_options['storage']['prefix_key'].$id, $lifetime ? $lifetime : self::MAX_LIFETIME);
        if ($addTags = ($oldTags ? array_diff($tags, $oldTags) : $tags)) {
            foreach ($addTags as $add) {
                $this->_getTransactionByKey($this->_options['storage']['set_tags'])
                    ->addToSet($this->_options['storage']['set_tags'], $add);
            }
            foreach($addTags as $tag){
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->addToSet($this->_options['storage']['prefix_tag_ids'] . $tag, $id);
            }
        }
        if ($remTags = ($oldTags ? array_diff($oldTags, $tags) : false)){
            foreach($remTags as $tag){
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->deleteFromSet($this->_options['storage']['prefix_tag_ids'] . $tag, $id);
            }
        }
        $this->_getTransactionByKey($this->_options['storage']['set_ids'])
            ->addToSet($this->_options['storage']['set_ids'], $id);
        try {
            $this->_execTransactions();
            return true;
        } catch(Rediska_Transaction_Exception $e){
            $this->_log($e->getMessage(), Zend_Log::ERR);
            return false;
        }

    }
public function save($data, $id, $tags = array(), $specificLifetime = false)
    {
        if(!is_array($tags)) $tags = array($tags);

        $lifetime = $this->getLifetime($specificLifetime);

        $oldTags = explode(
            ',', $this->getRediska()->getFromHash(
                $this->_options['storage']['prefix_key'].$id, self::FIELD_TAGS
            )
        );

        $this->_getTransactionByKey($this->_options['storage']['prefix_key'].$id)
            ->setToHash(
                $this->_options['storage']['prefix_key'].$id,  array(
                self::FIELD_DATA => $data,
                self::FIELD_TAGS => implode(',',$tags),
                self::FIELD_MTIME => time(),
                self::FIELD_INF => $lifetime ? 0 : 1)
            );
        $this->_getTransactionByKey($this->_options['storage']['prefix_key'].$id)
            ->expire($this->_options['storage']['prefix_key'].$id, $lifetime ? $lifetime : self::MAX_LIFETIME);
        if ($addTags = ($oldTags ? array_diff($tags, $oldTags) : $tags)) {
            foreach ($addTags as $add) {
                $this->_getTransactionByKey($this->_options['storage']['set_tags'])
                    ->addToSet($this->_options['storage']['set_tags'], $add);
            }
            foreach($addTags as $tag){
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->addToSet($this->_options['storage']['prefix_tag_ids'] . $tag, $id);
            }
        }
        if ($remTags = ($oldTags ? array_diff($oldTags, $tags) : false)){
            foreach($remTags as $tag){
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->deleteFromSet($this->_options['storage']['prefix_tag_ids'] . $tag, $id);
            }
        }
        $this->_getTransactionByKey($this->_options['storage']['set_ids'])
            ->addToSet($this->_options['storage']['set_ids'], $id);
        try {
            $this->_execTransactions();
            return true;
        } catch(Rediska_Transaction_Exception $e){
            $this->_log($e->getMessage(), Zend_Log::ERR);
            return false;
        }

    }
public function save ( $ data , $ id , $ tags = array ( ) , $ specificLifetime = false ) { if ( ! is_array ( $ tags ) ) $ tags = array ( $ tags ) ; $ lifetime = $ this -> getLifetime ( $ specificLifetime ) ; $ oldTags = explode ( ',' , $ this -> getRediska ( ) -> getFromHash ( $ this -> _options [ 'storage' ] [ 'prefix_key' ] . $ id , self :: FIELD_TAGS ) ) ; $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'prefix_key' ] . $ id ) -> setToHash ( $ this -> _options [ 'storage' ] [ 'prefix_key' ] . $ id , array ( self :: FIELD_DATA => $ data , self :: FIELD_TAGS => implode ( ',' , $ tags ) , self :: FIELD_MTIME => time ( ) , self :: FIELD_INF => $ lifetime ? 0 : 1 ) ) ; $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'prefix_key' ] . $ id ) -> expire ( $ this -> _options [ 'storage' ] [ 'prefix_key' ] . $ id , $ lifetime ? $ lifetime : self :: MAX_LIFETIME ) ; if ( $ addTags = ( $ oldTags ? array_diff ( $ tags , $ oldTags ) : $ tags ) ) { foreach ( $ addTags as $ add ) { $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'set_tags' ] ) -> addToSet ( $ this -> _options [ 'storage' ] [ 'set_tags' ] , $ add ) ; } foreach ( $ addTags as $ tag ) { $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag ) -> addToSet ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag , $ id ) ; } } if ( $ remTags = ( $ oldTags ? array_diff ( $ oldTags , $ tags ) : false ) ) { foreach ( $ remTags as $ tag ) { $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag ) -> deleteFromSet ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag , $ id ) ; } } $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'set_ids' ] ) -> addToSet ( $ this -> _options [ 'storage' ] [ 'set_ids' ] , $ id ) ; try { $ this -> _execTransactions ( ) ; return true ; } catch ( Rediska_Transaction_Exception $ e ) { $ this -> _log ( $ e -> getMessage ( ) , Zend_Log :: ERR ) ; return false ; } }
Save some string datas into a cache record

Note : $data is always "string" (serialization is done by the
core not by the backend)

@param  string  $data             Datas to cache
@param  string  $id               Cache id
@param  array   $tags             Array of strings, the cache record will be tagged by each string entry
@param  int     $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
@return boolean True if no problem
Save some string datas into a cache record