ericflo / django-newcache

Improved memcached cache backend for Django
189 stars 21 forks source link

Don't extend key life beyond original timeout #6

Open jdunck opened 13 years ago

jdunck commented 13 years ago

I think it'd be good if newcache didn't extend key life. Currently, .set extends to timeout + HERD_TIMEOUT. I realize that the miss should later re-call set, but if it fails to, the key lives beyond its intended lifespan.

I think it would be good to (optionally, maybe) instead back off the given timeout so that a miss is before the given timeout.

I did this a long time ago, but shows the general idea: http://code.djangoproject.com/attachment/ticket/6199/cache_avoid_stampede.diff

jdunck commented 13 years ago

I should note, if you're happy to take this upstream, I'm happy to do the work.