protected function _collectGarbage()
    {
        $exists = array();
        $tags = $this->getTags();
        foreach($tags as $tag){
            $prefix_tag_ids = $this->_options['storage']['prefix_tag_ids'] . $tag;
            $tagMembers = $this->getRediska()->getSet($prefix_tag_ids);
            $this->_getTransactionByKey($prefix_tag_ids)->watch($prefix_tag_ids);
            $expired = array();
            if(count($tagMembers)) {
                foreach($tagMembers as $id) {
                    if( ! isset($exists[$id])) {
                        $exists[$id] = $this->getRediska()
                            ->exists($this->_options['storage']['prefix_key'].$id);
                    }
                    if(!$exists[$id]) {
                        $expired[] = $id;
                    }
                }
                if(!count($expired)) continue;
            }
            if(!count($tagMembers) || count($expired) == count($tagMembers)) {
                $this->_getTransactionByKey($this->_options['storage']['set_tags'])
                    ->deleteFromSet($this->_options['storage']['set_tags'], $tag);
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->delete($this->_options['storage']['prefix_tag_ids'] . $tag);
            } else {
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->deleteFromSet( $this->_options['storage']['prefix_tag_ids'] . $tag, $expired);
            }
            $this->_getTransactionByKey($this->_options['storage']['set_ids'])
                ->deleteFromSet( $this->_options['storage']['set_ids'], $expired);
        }
        try{
            return (bool) $this->_execTransactions();
        } catch (Rediska_Transaction_AbortedException $e ){
            $this->_log($e->getMessage(), Zend_Log::ERR);
            return false;
        }
    }
protected function _collectGarbage()
    {
        $exists = array();
        $tags = $this->getTags();
        foreach($tags as $tag){
            $prefix_tag_ids = $this->_options['storage']['prefix_tag_ids'] . $tag;
            $tagMembers = $this->getRediska()->getSet($prefix_tag_ids);
            $this->_getTransactionByKey($prefix_tag_ids)->watch($prefix_tag_ids);
            $expired = array();
            if(count($tagMembers)) {
                foreach($tagMembers as $id) {
                    if( ! isset($exists[$id])) {
                        $exists[$id] = $this->getRediska()
                            ->exists($this->_options['storage']['prefix_key'].$id);
                    }
                    if(!$exists[$id]) {
                        $expired[] = $id;
                    }
                }
                if(!count($expired)) continue;
            }
            if(!count($tagMembers) || count($expired) == count($tagMembers)) {
                $this->_getTransactionByKey($this->_options['storage']['set_tags'])
                    ->deleteFromSet($this->_options['storage']['set_tags'], $tag);
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->delete($this->_options['storage']['prefix_tag_ids'] . $tag);
            } else {
                $this->_getTransactionByKey($this->_options['storage']['prefix_tag_ids'] . $tag)
                    ->deleteFromSet( $this->_options['storage']['prefix_tag_ids'] . $tag, $expired);
            }
            $this->_getTransactionByKey($this->_options['storage']['set_ids'])
                ->deleteFromSet( $this->_options['storage']['set_ids'], $expired);
        }
        try{
            return (bool) $this->_execTransactions();
        } catch (Rediska_Transaction_AbortedException $e ){
            $this->_log($e->getMessage(), Zend_Log::ERR);
            return false;
        }
    }
protected function _collectGarbage ( ) { $ exists = array ( ) ; $ tags = $ this -> getTags ( ) ; foreach ( $ tags as $ tag ) { $ prefix_tag_ids = $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag ; $ tagMembers = $ this -> getRediska ( ) -> getSet ( $ prefix_tag_ids ) ; $ this -> _getTransactionByKey ( $ prefix_tag_ids ) -> watch ( $ prefix_tag_ids ) ; $ expired = array ( ) ; if ( count ( $ tagMembers ) ) { foreach ( $ tagMembers as $ id ) { if ( ! isset ( $ exists [ $ id ] ) ) { $ exists [ $ id ] = $ this -> getRediska ( ) -> exists ( $ this -> _options [ 'storage' ] [ 'prefix_key' ] . $ id ) ; } if ( ! $ exists [ $ id ] ) { $ expired [ ] = $ id ; } } if ( ! count ( $ expired ) ) continue ; } if ( ! count ( $ tagMembers ) || count ( $ expired ) == count ( $ tagMembers ) ) { $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'set_tags' ] ) -> deleteFromSet ( $ this -> _options [ 'storage' ] [ 'set_tags' ] , $ tag ) ; $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag ) -> delete ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag ) ; } else { $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag ) -> deleteFromSet ( $ this -> _options [ 'storage' ] [ 'prefix_tag_ids' ] . $ tag , $ expired ) ; } $ this -> _getTransactionByKey ( $ this -> _options [ 'storage' ] [ 'set_ids' ] ) -> deleteFromSet ( $ this -> _options [ 'storage' ] [ 'set_ids' ] , $ expired ) ; } try { return ( bool ) $ this -> _execTransactions ( ) ; } catch ( Rediska_Transaction_AbortedException $ e ) { $ this -> _log ( $ e -> getMessage ( ) , Zend_Log :: ERR ) ; return false ; } }
Cleans up expired keys and list members
@return boolean
Cleans up expired keys and list members