Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cache = memcache.Client(['localhost:11211'])
- def memcached(key):
- def func_wrapper(func):
- def arg_wrapper(*args, **kwargs):
- value = cache.get(str(key))
- if not value:
- value = func(*args, **kwargs)
- cache.set(str(key), value)
- return value
- return arg_wrapper
- return func_wrapper
Advertisement
Add Comment
Please, Sign In to add comment