Tragic you're doing it wrong.

You don't need PEEK but something that would prevent a race condition 
occuring when you generate that data, because otherwise you'll probably end 
with load spikes or ocassional bad performance, you could even kill the 
server if regenerating the data requires a lot of memory.

You can see FAQ about this:
http://code.google.com/p/memcached/wiki/NewProgrammingTricks 


KEY = EXPIRE_TIME;data with key expire time >> EXPIRE_TIME
on read check expire_time > now OR key=false
if TRUE, use ADD to claim a lock for the time you need to generate the data 
* 2 (KEY + "L" for example) if ok generate data, update they key... if not, 
use the old data and continue

if you have no "old" value... you need to generate the second time or wait.

But unfortunately the only way of preventing bad things happening on the 
"standard" server stack is... showing users old data.

Reply via email to