Saying *NO* to stale data

Michael Carter cartermichael at gmail.com
Wed Jul 5 15:44:48 UTC 2006


Thank you for so concisely listing the options. I appreciate it.


- use memcached's "add" function to create a lock:
> while (!memcached.add("lock_user_1")) sleep (1);
> ... fetch user 1 from memcache or DB, update user 1, save to DB and
> memcache ...
> memcached.delete("lock_user_1");


With even simple apps with very small user bases, it would be almost
impossible to avoid deadlock situations.


>The final solution is to just expire the data whenever its updated,
> >but that seems awfully wasteful.
>
> How so?
>
> Jacques.
>
>
>
Well, its wasteful because I know what that data is and I rather not have to
run an extra select. But you're right, perhaps it isn't wasteful because its
necessary. I don't see any other way out of it.

Thank you,

Michael Carter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20060705/b1aad5c4/attachment.html


More information about the memcached mailing list