Answers for "simplest flask memcached"

0

simplest flask memcached

from werkzeug.contrib.cache import MemcachedCache
cache = MemcachedCache(['127.0.0.1:11211'])

def get_my_item():
    rv = cache.get('my-item')
    if rv is None:
        rv = calculate_value()
        cache.set('my-item', rv, timeout=5 * 60)
    return rv
Posted by: Guest on March-26-2021

Code answers related to "simplest flask memcached"

Python Answers by Framework

Browse Popular Code Answers by Language