Hi,
Jan Pieper a écrit :
Can you please show us an example how to realize tagged-memcache-caching with
this new two-level backend?
something like that (not tested) :
<?php
$slowBackend = 'File';
$fastBackend = 'Memcached';
$slowBackendOptions = array(
'cache_dir' => '/tmp/'
);
$fastBackendOptions = array|(
'servers' => ||array(array('host' => 'localhost','port' => 11211,
'persistent' => true))|
);
$backendOptions = array(
'fast_backend' => $fastBackend,
'slow_backend' => $slowBackend,
'fast_backend_options' => $fastBackendOptions,
'slow_backend_options' => $slowBackendOptions
);
$frontendOptions = array(|
'lifetime' => 7200|
);
$instance = Zend_Cache::factory('Core','Two Levels', $frontendOptions,
$backendOptions);
// [...] use $instance normaly
?>
- tags will be supported throw the "slow" backend
- there is a (simple) algorithm to store cache records into the fast
backend or into the slow backend depending on the remaining space on the
fast one and the cache priority (new option you can set when you save
the cache)
I'm very interested in feedbacks for this new special backend.
Regards
Fabien
Fabien MARTY wrote:
Hi,
Please have a look at the "TwoLevels" backend in 1.7 trunk (or in 1.7
PR), it's want you want.
It does exactly this.
Feedback welcome
Regards,
Fabien
On Wed, Oct 22, 2008 at 5:34 PM, Diabl0 <[EMAIL PROTECTED]> wrote:
Colin Guthrie pisze:
Diabl0 wrote:
Hi
As i seen this topic was discussed later, but i have new idea that IMHO
can throw new light.
What about combining memory cache backends with file cache fallback for
tags? Ofcorse optional if someone wants this.
This should give us benefits from fast memory cache and tagging system
with only small drawback on performance needed to update (or retreive)
tags
cache from filesystem.
And what you think about this idea?
It's interesting but why use the filesystem? Why not use the cache
itself
but use a different key structure to track this (e.g. cache an array of
keys
that match the tag "wibble" under the key name
"Zend_Cache-keymap-wibble"?
This approach could be implemented in a base class and those backends
not
supporting tags could simple extend it. I've not looked at the
intricacies
of this from a data integrity point of view so there could be several
reasons why this wouldn't work :)
Filesystem was my first idea, but db and any other "solid" backend is
good.
Memcached and other memory based backends aren't good because it's
content
can be deleted in any time.
Also as a related issue, would it be possible to implement a cache
invalidation queue system backed by a database? The reason I say this is
when considering multi-server environments (let's assume there is one
database for all servers).
See my post with Mao_Cache. I didn't tested it with DB yet, but i was
also
thinking about clustered enviroments.
--
K.
--
Fabien MARTY
[EMAIL PROTECTED]