Am Dienstag, den 19.08.2008, 23:38 +0200 schrieb Fabien MARTY:
[...]
> So, it's difficult to implement tags in a good way in such conditions
>
> I'm working now on a "two levels" backend (a fast but limited one like
> Apc/Memcache/... and a less fast (but without low space limits)
> backend like File/Sqlite/...).
>
> Tags will be probably usable on this virtual backend which should be a
> very cool thing.
The usual way to implement cache entry tagging with Memcache is to use
its increment/decrement feature. If you want to save $data as "foo" with
tags "bar" and "baz" the final cache key for $data is composed of the
count for "tag_bar" and "tag_baz" like this:
key = foo + get(tag_bar) + get(tag_baz)
To invalidate a tag, you just increment the value for tag_baz. If
tag_baz vanishes every member of the tag is invalidated, so no issue.
cu, Lars
没有评论:
发表评论