This is described pretty well in FAQ: (
http://www.socialtext.net/memcached/index.cgi?faq)
Namespaces
memcached does not support namespaces. However, there are some options to
simulate them.
Simulating Namespaces with key prefixes
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".
Deleting by Namespace
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");
On Wed, Sep 24, 2008 at 7:40 AM, vp <[EMAIL PROTECTED]> wrote:
>
> Hey , can you tell me exactly how do you do the prepending
>
> On Sep 19, 7:46 pm, "Henrik Schröder" <[EMAIL PROTECTED]> wrote:
> > I'm not familiar with the memcached taglib, but generally you cannot
> delete
> > groups of keys from memcached without knowing the exact key name. This is
> a
> > very common problem because you don't always know exactly what keys you
> have
> > created that belong to a certain group, you only know that you want to
> > invalidate the whole group.
> >
> > We solve this in our products by doing a double fetch, we store a prefix
> > under the group name, and then all keys that belong to the group gets
> this
> > prefix prepended to them. If you then change the prefix for a group, you
> > invalidate all the keys in that group. I have absolutely no idea if you
> can
> > do this with the taglib (I'm guessing not), but it could perhaps be
> > implemented as a feature of the taglib itself?
> >
> > /Henrik Schröder
> >
> > On Fri, Sep 19, 2008 at 7:52 AM, vp <[EMAIL PROTECTED]> wrote:
> >
> > > 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 .
>
--
--Boris