Diabl0 pisze:

Ok, here you can download and test my fast implementation. It's only example, so it still need some testing and probably improvements.

Unfortutnenty, trying to implement Mao_Cache::CLEANING_MODE_MATCHING_ANY_TAG (in my opinion very useful and i will submit it as suggestion for ZF team) i was forced to create own copy of Zend_Cache and Zend_Cache_Core, but there are only few changes - rest is oryginal ZF 1.6.1 file.

Example of use:

        $frontendOptions = array ('automatic_serialization' => true );
$memcachedMetadataFileBackendOptions = array ('cache_dir' => APPLICATION_PATH . 'temp/memcached' );

        $memcachedOptions = array(
            'metadatabackend' => array(
                'backend' => 'File',
                'options' => $memcachedMetadataFileBackendOptions
            ),
'servers' => array(array('host' => 'localhost','port' => 11211, 'persistent' => true))
        );

$cache = Zend_Cache::factory ( 'Mao_Cache_Core', 'Mao_Cache_Backend_Memcached', $frontendOptions, $memcachedOptions, true, true );


        $cache->save( 'test2', 'test2', array('tags', 'tag2'), 9090);
        $cache->save( 'test1', 'test1', array('tags', 'tag1'), 9090);

$cache->clean(Mao_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tag1'));

        echo '<pre>T1: '; var_dump( $cache->load('test1') ); echo '</pre>';
        echo '<pre>T2: '; var_dump( $cache->load('test2') ); echo '</pre>';


All files are here: http://www.gazeta.ie/xxx/Mao_Cache.zip

--
Krzysztof Szatanik

Reply via email to