flushing items by prefix

Brad Fitzpatrick brad at danga.com
Sun Apr 3 19:36:02 PDT 2005


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.

- Brad


On Thu, 31 Mar 2005, Patrick Feisthammel wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi!
>
> We started using memcache and needed a possibility to delete entries
> from the cache by a given prefix of the key. For example all entries
> with a key starting with 'namespace1'.
>
> I wrote a patch for memcache to support a new command
>
> ~  flush_prefix <keyprefix>
>
> where <keyprefix> is the prefix of the keys to be deleted.
>
> The command just iterates through all items and compares the stored key
> with the given <keyprefix>. If it matches, the item is deleted.
>
> I do not check any flags of the items an I do not check time stamps.
> If someone with more knowledge about the internals has suggestions for
> improvement, I am happy to implement it.
>
> The code passed our test cases and I would be happy if it is included in
> the current version.
> The patch is against the current cvs version of today.
>
> The patch can be downloaded from:
>
> ~   http://work.citrin.ch/patch_memcache_flush_prefix
>
> Cheers,
> Patrick
> - --
> Citrin, Feisthammel und Partner,             Phone: +41 44 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)
>
> iD8DBQFCS68mSUE6YzGusa8RAvh1AJwP+QikWs9Tqm0UkAaxJgQw/KHJ9QCfV6lx
> qaFCmdRUGrpy5mg4yh0VAZc=
> =wopG
> -----END PGP SIGNATURE-----
>
>


More information about the memcached mailing list