Delete keys with wildcard?

1,929 views
Skip to first unread message

StormByte

unread,
Mar 30, 2012, 6:19:49 AM3/30/12
to memcached
Is it possible (or planned) to delete (or mark as invalid) keys with
wildcards?

Suppose we have plenty of keys stored in memcache, and want to remove
certain group from cache, example, any key like "AccountData:*" being
* anything.

Is it possible or scheduled to implement?

Brian Moon

unread,
Mar 30, 2012, 10:44:48 AM3/30/12
to memc...@googlegroups.com, StormByte

StormByte

unread,
Mar 30, 2012, 11:09:54 AM3/30/12
to memcached
OOh! Many thanks, though, after reading I think I have a simpler idea:

Instead of incrementing that namespaces, I though another aproach:

Just, prior to get anything from cache, get the 'namespace' data and
ignore its content, just see if exists or not.
if it exists, then you can proceed to gather the cache data you need
if not, then recreate the cache with the data you have (from DB,
etc...)

To invalidate, remove that key

As I see it, only race condition is posible at the time to invalidate
the namespace and the effect of that race condition is not that
important.

Thanks for the tip :)

On 30 mar, 16:44, Brian Moon <br...@moonspot.net> wrote:
> This technique is your best bet.
>
> http://code.google.com/p/memcached/wiki/NewProgrammingTricks#Namespacing
>
> Brian.http://brian.moonspot.net

StormByte

unread,
Apr 4, 2012, 8:13:31 PM4/4/12
to memcached
I've posted in my blog about the namespace issue, and implemented (and
sharing it via github public repo) my approach to achieve that, having
in mind the feature to bind more than one namespace to certain key.

I'd like to post it here to have some attention, maybe someone finds
it useful (that's the purpose I shared my code publicly).

http://stormbyte.blogspot.com.es/2012/04/implementing-namespaces-with-memcached.html

P.S. Don't take this as spam, I just want to give back what memcache
and its community gave me :)
Reply all
Reply to author
Forward
0 new messages