Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Dogpile support for cherrypy.

Project description

dogpile support for cherrypy.

Installation

pip install marbaloo_dogpile

Usage

# app.py
import cherrypy
import marbaloo_dogpile
import os

marbaloo_dogpile.Plugin(cherrypy.engine).subscribe()
cherrypy.tools.dogpile = marbaloo_dogpile.Tool()


class Root(object):

    @cherrypy.expose
    def index(self):
        dogpile = cherrypy.request.dogpile
        counter = dogpile.get('counter')
        counter = 0 if isinstance(counter, int) is False else counter
        dogpile.set('counter', counter + 1)
        return str(counter)

root_path = os.path.dirname(__file__)
dogpile_dbm_path = os.path.join(root_path, 'dogpile.dbm')
config = {
    'global': {
        'marbaloo_dogpile': {
            'backend': 'dogpile.cache.dbm',
            'expiration_time': 3600,
            'arguments': {'filename': dogpile_dbm_path},
        }
    },
    '/': {
        'tools.dogpile.on': True
    }
}
cherrypy.quickstart(Root(), '/', config)

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 marbaloo_dogpile, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size marbaloo_dogpile-0.1.0.tar.gz (2.5 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