Protcol Additions

Cahill, Earl ecahill at
Fri Nov 18 10:32:19 PST 2005

-1 for wildcard support
+1 for name space support

Perl's Cache::MemoryCache module allows you to define namespaces in your

my $cache = new Cache::MemoryCache( { 'namespace' => 'MyNamespace',
                                        'default_expires_in' => 600 } );

I like that much better than defining namespace in your key name.  Then
you don't need to parse out the name space.

And just as a pre-empt, there isn't really namespace support in the perl
API, which is what brad responded with when I asked him about namespace
support at oscon. In my reading, Cache::Memcached::Managed uses its
namespace just to figure out the key name

$key = $namespace.$delimiter.$version.$delimiter.$key

I guess I can see a use for that, but really, I want to be able to
delete a whole set of stuff with a single call.

I know this has been a recent topic on the list, and I know that some
folks seem opposed to it, but I would like namespace support to be able
to do "smarter" caching of database tables. 

I have been meaning to write up some pseudo code to show how it could
work, but really, I would like a system that I could send simple queries
through, and have it hit memcache first.  If there is an update or
delete, then wipe the cache.  But, for tables with primary keys (doesn't
really work otherwise, but who doesn't use primary keys) I think I could
do it on a row level, which would beat the mysql table-level query

That said, I can also buy perrin's argument that I don't really want to
write my own db, and parsing page long queries to find the tables and
primary keys, does seem to be a bit much.  Guess I can see it for tables
with just a join or two, where the joined tables are rather static, that
delimit to a single row.  You know, kind of like a hash?

I have been tempted to keep track of everything using memcache, but have
been holding out for namespace support.


More information about the memcached mailing list