Created
June 19, 2014 15:36
-
-
Save tav/2834810b723f8ba86e83 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 sentinel import handle, Timeout | |
@handle(public=True) | |
def location_find(ctx, place): | |
cache_key = 'location.find|%s' % place | |
try: | |
area = ctx.cache.get(cache_key, deadline=20) | |
except Timeout: | |
area = None | |
if not area: | |
area = "%s-%s" % (place, place) | |
ctx.cache.set(cache_key, area) | |
return area |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment