Created
July 28, 2013 00:33
-
-
Save numan/6096878 to your computer and use it in GitHub Desktop.
customized cached_with for django-cache-machine to use with django-tastypie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from caching.base import cached_with as official_cached_with | |
def cached_with(obj, f, f_key, timeout=None): | |
"""Helper for caching a function call within an object's flush list.""" | |
if hasattr(obj, "exists") and not obj.exists(): | |
return f() | |
return official_cached_with(obj, f, f_key, timeout=timeout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment