flushing items by prefix

Cahill, Earl ecahill at corp.untd.com
Mon Apr 4 10:39:52 PDT 2005


I played with perl's Cache::Cache over the weekend which allows for
different namespaces, and I was a fan.  I also happened to use different
objects for each distinct namespace, mostly because the cache for my product
namespace came from a different place than the cache for my category
namespace.  And if worse came to worse, I would have been fine adding a
set_namespace call or the like to each method.  So long as your stuff is
well architected, like gets and sets in one place, then for me, adding a
line here and there is no big deal.

Course the default namespace could just be '' so that everything had a
namespace, then old code wouldn't have to be changed.  

For the record, I have wanted namespaces in Memcached.  I almost started to
store stuff with different prefixes so I could go through and clear things
out, as per this discussion.

Earl

> -----Original Message-----
> From: memcached-bounces at lists.danga.com [mailto:memcached-
> bounces at lists.danga.com]
> Sent: Sunday, April 03, 2005 11:13 PM
> To: Brad Fitzpatrick
> Cc: memcached at lists.danga.com
> Subject: Re: flushing items by prefix
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Brad
> 
> | But now we go from everything inside memcached being O(1) to suddenly
> | having a potentially slow O(n) operation.
> |
> | The way I'd prefer to see this done is finish doing server-side
> namespace
> | support, then support a wipe on a namespace.
> 
> I completly agree on that. O(n) is bad.
> 
> I see two possible solutions for that:
> 
> a) A major change in the API, because all requests have to add the
> namespace they are ment for.
> 
> b) An additional command 'set_namespace'. Alle following commands in the
> ~ current connection work within the given namespace until the next
> 'set_namespace' is given.
> 
> I think b) is the way to go. It does only add one additional command and
> does not change the current API. I think also that most of the time you
> have one namespace per connection. So the namespace can be set just
> after making the connection.
> Drawback: If you use multiple namespaces within one connection you have
> always to prepend the 'set_namespace'.
> 
> What do you think?
> 
> Cheers,
> Patrick
> 
> - --
> Citrin, Feisthammel und Partner,             Phone: +41 1 940 6161
> Steigstrasse 55, CH-8610 Uster, Switzerland  Fax:  +41 43 399 0506
> http://www.citrin.ch/                        email: citrin at citrin.ch
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQFCUMzySUE6YzGusa8RAnBpAJ4umZAX9cNPY5+hfDben6PDG8B6IACfS0ex
> rhyooBzCXKqmydHs5AFe3Vc=
> =3eKQ
> -----END PGP SIGNATURE-----


More information about the memcached mailing list