namespace bids

Joshua Thijssen jthijssen at noxlogic.nl
Thu Feb 2 09:43:38 UTC 2006


This is exactly the way we are doing "wildcard"-deletes inside the
memcache. However, but many suggest (and i basically agree with them),
is that you are storing probably duplicate data in relatively expensive
caching-memory. Since memcache is used for caching, it means that the
original keys are stored inside probably a db-table. If there are
changes (everything from table "fred" should be deleted), it's probably
best to delete all rows from fred and simultaneously delete the proper
key from the cache as well.

For instance:
The query "delete * from articles where category=15" should not be used,
instead:

select * from articles where category=15
while fetchrow result
  delete row.article_id
  cache->delete (namespace.article_id)
end

This would eliminate the need for an existing table inside the memcache.


Christopher Gillett wrote:
> You could store "private" keys in a namespace by using a naming
> convention (pythonically by __ or use your own scheme), like:
>
> 	namespace.__keys  = private list of keys in the namespace
>       namespace.keys    = a public key named "keys" within the namespace
>
> Then deleting the namespace becomes:
>
>    deleteNameSpaceFromCache( namespace ):
> 	keysToNuke = get( "namespace.__keys" )
>       for k in keysToNuke:
>           delete( namespace+"."+k )
>       delete( namespace+".__keys" )
>





More information about the memcached mailing list