Saying *NO* to stale data
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 ...
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?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the memcached