Skip to main content

A caching front-end based on the Dogpile lock.

Project description

Dogpile consists of two subsystems, one building on top of the other.

dogpile provides the concept of a “dogpile lock”, a control structure which allows a single thread of execution to be selected as the “creator” of some resource, while allowing other threads of execution to refer to the previous version of this resource as the creation proceeds; if there is no previous version, then those threads block until the object is available.

dogpile.cache is a caching API which provides a generic interface to caching backends of any variety, and additionally provides API hooks which integrate these cache backends with the locking mechanism of dogpile.

Overall, dogpile.cache is intended as a replacement to the Beaker caching system, the internals of which are written by the same author. All the ideas of Beaker which “work” are re- implemented in dogpile.cache in a more efficient and succinct manner, and all the cruft (Beaker’s internals were first written in 2005) relegated to the trash heap.

Documentation

See dogpile.cache’s full documentation at dogpile.cache documentation. The sections below provide a brief synopsis of the dogpile packages.

Features

  • A succinct API which encourages up-front configuration of pre-defined “regions”, each one defining a set of caching characteristics including storage backend, configuration options, and default expiration time.

  • A standard get/set/delete API as well as a function decorator API is provided.

  • The mechanics of key generation are fully customizable. The function decorator API features a pluggable “key generator” to customize how cache keys are made to correspond to function calls, and an optional “key mangler” feature provides for pluggable mangling of keys (such as encoding, SHA-1 hashing) as desired for each region.

  • The dogpile lock, first developed as the core engine behind the Beaker caching system, here vastly simplified, improved, and better tested. Some key performance issues that were intrinsic to Beaker’s architecture, particularly that values would frequently be “double-fetched” from the cache, have been fixed.

  • Backends implement their own version of a “distributed” lock, where the “distribution” matches the backend’s storage system. For example, the memcached backends allow all clients to coordinate creation of values using memcached itself. The dbm file backend uses a lockfile alongside the dbm file. New backends, such as a Redis-based backend, can provide their own locking mechanism appropriate to the storage engine.

  • Writing new backends or hacking on the existing backends is intended to be routine - all that’s needed are basic get/set/delete methods. A distributed lock tailored towards the backend is an optional addition, else dogpile uses a regular thread mutex. New backends can be registered with dogpile.cache directly or made available via setuptools entry points.

  • Included backends feature three memcached backends (python-memcached, pylibmc, bmemcached), a Redis backend, a backend based on Python’s anydbm, and a plain dictionary backend.

  • Space for third party plugins, including one which provides the dogpile.cache engine to Mako templates.

The SQLAlchemy Project

Dogpile is part of the SQLAlchemy Project and adheres to the same standards and conventions as the core project.

Development / Bug reporting / Pull requests

Please refer to the SQLAlchemy Community Guide for guidelines on coding and participating in this project.

Code of Conduct

Above all, SQLAlchemy places great emphasis on polite, thoughtful, and constructive communication between users and developers. Please see our current Code of Conduct at Code of Conduct.

License

Dogpile is distributed under the MIT license.

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

dogpile_cache-1.4.1.tar.gz (940.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dogpile_cache-1.4.1-py3-none-any.whl (63.6 kB view details)

Uploaded Python 3

File details

Details for the file dogpile_cache-1.4.1.tar.gz.

File metadata

  • Download URL: dogpile_cache-1.4.1.tar.gz
  • Upload date:
  • Size: 940.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for dogpile_cache-1.4.1.tar.gz
Algorithm Hash digest
SHA256 e25c60e677a5e28ff86124765fbf18c53257bcd7830749cd5ba350ace2a12989
MD5 55c5155755b9f47f45b7ed36fdad88a7
BLAKE2b-256 8697da72845c89c9aa70e3e74609b864eff5e5c2ec46366645e7bb61eaa29e9c

See more details on using hashes here.

File details

Details for the file dogpile_cache-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: dogpile_cache-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 63.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for dogpile_cache-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99130ce990800c8d89c26a5a8d9923cbe1b78c8a9972c2aaa0abf3d2ef2984ad
MD5 14b78781cdd5b2163aefd62295e1f985
BLAKE2b-256 d3f61d9579d7b86e7957dd626e52b65c72af0fcd47b277716efd9889990d92b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page