Hi,
I don't understand how this TwoLevels cache should work and I see some odd
results quick tests.
Is that it will use fast cache for untagged entries, and slow for tagged
entries? Cuz sometimes I see both entries in APC and in SQLite
Sometimes I see it only in SQLite.
With the "two levels" backend, there is an adaptive algorithm depending on :
- the remaining space in the fast backend
- the priority (between 0 and 10) given to the cache record (optional)
===> When you save datas which the "two levels" backend :
($usage is between 0 (nothing) and 100 (full))
if (($priority > 0) && (10 * $priority >= $usage)) {
=> cache into the fast backend AND into the slow backend
} else {
=> cache into the slow backend only
}
When saving a cache record into the fast backend, a special lifetime is
used :
$fastLifetime = (int) ($lifetime / (11 - $priority));
===> When loading datas :
we try the fast backend
=> hit => we use it
=> not hit => we try with the slow backend
if the cache is hit and if auto_refresh_fast_cache is on, we refresh the
lifetime of the fast backend (without of course making it bigger than
the original lifetime)
===> When using tags :
we use the slow backend (because tags are not reliable with fast backends)
The whole thing is a simple algorithm but it tries to use the fast
backend in the better way depending of remaining space and priority.
Probably, some people will have different ideas. I'm ready to discuss
them in the issue tracker.
My quick testing using TwoLevels, showed that application became much
slower than without the cache.
I used APC-SQLite.
It's possible, depending of your cache use.
And sometimes it throws fatal erros when it tries to access cached data as
array although it's object.
Check file TwoLevels.php on line 206 (or so)
Can you be more precise on this particular thing ? Are you sure to not
share cache ids between different backends (because backends don't
store same datas in the same way).
Regards
Fabien