Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #simplest #flask #memcached
ADD COMMENT
Topic
Name
2+6 =