Skip to main content

Adds dogpile.cache support to your Flask application

Project description

Easy to Use

# ==================== ====================

    ('hour', 3600),
    ('day', 3600 * 24),
    ('month', 3600 * 24 * 31),
# Default settings:
# DOGPILE_CACHE_BACKEND = 'dogpile.cache.memcached'

# ==================== ====================

import config
from flask import Flask
from flask.ext.dogpile_cache import DogpileCache

app = Flask(__name__)

cache = DogpileCache()
# Alternative way: cache = DogpileCache(app)

def cached_func(*args):
    print "Heavy computation here", args
    return args

value = cached_func()

cache.invalidate(cached_func, *args)  # Invalidating cache for cached_func
cache.refresh(cached_func, *args)     # Refreshing cache for cached_func
cache.set(cached_func, value, *args)  # Setting custom value for cached_func
cache.invalidate_region('hour')       # Invalidate cache for all funcs
                                      # decorated with @cache.region('hour')
cache.invalidate_all_regions()        # Invalidate cache for all funcs
                                      # decorated with @cache.region

Easy to Install

$ pip install Flask-Dogpile-Cache

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-Dogpile-Cache, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size Flask-Dogpile-Cache-0.2.tar.gz (6.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page