I love and recommend Redis. If you can use a Redis key instead of Django's cache, you can call get() on the key. If the result is not None, now you have it. If it is None, you know it didn't exist, so you can set it.
I don't think it's possible to have it work the way you want with the default cache -- there's no way to know that in between checking for it and finding it empty and setting it some other process didn't just set it. You may have noticed there's still a tiny race condition in the naive use of Redis I described. That's easily handled using Redis's "watch" command. See: http://redis.io/commands/exec -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.