views:

122

answers:

2

Hello folks,

I am implementing caching for my Python application and I want to use memcached. Which module do you suggest me to use? There are so many that I don't know which one to choose.

Thanks, Boda Cydo.

+3  A: 

I use python-memcached and there's some good advice on usage in the source code header, referenced in this answer.

Use the third parameter to set the expiry.

From bundled memcached.html help file:

set(self, key, val, time=0, min_compress_len=0)

so

mc.set(key, val, time)

More info and exmaples here

Andy
Thanks! But do you know how to make a key expire? The examples on that page, just set the keys, but how to make them expire after, let's say 444 seconds?
bodacydo
@bodacydo update with 3rd param, answer updates
Andy
Python memcached seems good, thank you!
bodacydo
+2  A: 

I use cmemcache, which is more performant (but no more mantained). As its developer suggest, you can switch to http://code.google.com/p/python-libmemcached.

S.c.
I am confused now -- Isn't it the same?
bodacydo