Hii,
I am using the memcached taglib . most of the pages have pagination ie
the key is like topis_1 , topics_2 ... , so they all have a common
group Name "Topic"
Whenever a new topic is added or deleted , i need to flush all the
cached pages in group Topic.
i have added a flush tag on action :
<cache:flush scope="application" groups="Topic"/>
but this gives an error :
According to the TLD or the tag file, attribute key is mandatory for
tag flush
How can this problem be resolved ?
Any help will be appreciated .
Thanking in advance .
memcached does not support namespaces. However, there are some options to simulate them.
If you simply want to avoid key colision between different types of data, simply prefix your key with a useful string. For example: "user_12345", "article_76890".
While memcached does not support any type of wildcard deleting or deletion by namespace (since there are not namespaces), there are some tricks that can be used to simulate this. They do require extra trips to the memcached servers however.
Example, in PHP, for using a namespace called foo:
$ns_key = $memcache->get("foo_namespace_key");
// if not set, initialize it
if($ns_key===false) $memcache->set("foo_namespace_key", rand(1, 10000));
$my_key = "foo_".$ns_key."_12345";
To clear the namespace do:
$memcache->increment("foo_namespace_key");
Aaron
If you use a client which allows storage/fetch by 'master' key, you can
force both keys to always be on the same server. Then you always use a
multiget to fetch them back, which does one roundtrip.
libmemcached and Cache::Memcached support the fetch-by-master stuff.
-Dormando