Adds dogpile.cache support to your Flask application
Project description
Easy to Configure
# config.py
DOGPILE_CACHE_URLS = ("127.0.0.1:11211",)
DOGPILE_CACHE_REGIONS = (
('hour', 3600),
('day', 3600 * 24),
('month', 3600 * 24 * 31),
)
# Default settings:
# DOGPILE_CACHE_BACKEND = 'dogpile.cache.memcached'
# DOGPILE_CACHE_BINARY = True
Easy to Initialize
# app.py
import config
from flask import Flask
from flask.ext.dogpile_cache import DogpileCache
app = Flask(__name__)
app.config.from_object(config)
cache = DogpileCache()
cache.init_app(app)
# Alternative way: cache = DogpileCache(app)
Easy to Use
@cache.region('hour')
def cached_func(*args):
print "First time print", args
return args
value = cached_func()
# Invalidating
cache.invalidate(cached_func, *args)
# Refreshing
cache.refresh(cached_func, *args)
# Setting custom value
cache.set(cached_func, value, *args)
Easy to Install
$ pip install Flask-Dogpile-Cache
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for Flask-Dogpile-Cache-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37def517db6d442d96267ae89ca8466c72d6cf16fe6030f998fe65a5cb0c5a55 |
|
MD5 | 3faba5345b746dce873e6670f8766b13 |
|
BLAKE2b-256 | 820c83a4b762aef599c1e6612637632e4a686f21b416992ba2adaaa2f032c7d5 |