Skip to main content
Latest PyPI version Number of PyPI downloads Test bda.cache

General Caching API

This package is designed to be used by applications which require different kinds of caching flavour. This is abstracted due to the interfaces ICacheProvider and ICacheManager. ICacheProvider takes care of the concrete cache implementation, ICacheManager is the read/write interface.

The convention is to adapt a concrete ICacheProvider implementation

from bda.cache import ICacheManager
from bda.cache import Memcached

provider = Memcached(['127.0.0.1:11211'])
manager = ICacheManager(provider)

We can ask the manager for data inside the cache

data = manager.get('somekey', force_reload=False)

If force_reload is set to True, try to delete data with key from cache and return None.

We’re also able to manipulate the cache’s data (some restrictions my result out of backend not providing them)

manager.set('somekey', object())

There exist a convenience to use some API’s and cache it’s results all at once.

data = manager.getData(func, key, force_reload=False, args=[], kwargs={})

First the data for key is looked up inside the cache provider. If not found there or if force_reload is set to True, call given func . The return value of this function will be stored in the cache provider. args and kwargs are passed as parameters to given function if it’s call is required.

You might ask why all this is done due to 2 seperate interfaces…

Some usecase might require different cache providers i.e. for different payload size. This way you can implement any other cache provider usage as well due to the cache manager interface.

Dependencies

  • zope.interface

  • zope.component

  • bda.cache.memcached.Memcached requires python-memcached

Notes

If you’re interessted to contribute; Feel free but keep in mind that this code is planned to be released under a BSD like licence in future.

Changes

2.0.0 (2026-10-31)

  • Fix the client library selection in bda.cache.memcached if both libmc and pylibmc are installed. pylibmc.Client was initialized with the libmc arguments. libmc is preferred now, as intended. [rnix]

  • Drop the Python 2 remnants: the six imports in bda.cache.fscache and bda.cache.memcached (six never was a declared dependency), class X(object) and the IOError alias. Remove the unreachable code in FSCache.__delitem__ and the unused ICacheProvider import in bda.cache.memcached. Behaviour unchanged. [rnix]

  • Convert the doctests to unittest tests and use pytest as test runner. The memcached tests use a fake client and no longer need a running memcached server. Drop the interlude and zope.testing test dependencies. [rnix]

  • Sort the imports with ruff (one per line, from imports first, no sections) and format the code with ruff format (90 characters per line, single quotes). [rnix]

  • Add Makefile (mxmake) with qa.ruff, qa.test and qa.coverage domains, pin the ruff configuration in pyproject.toml and add a GitHub Actions test workflow. [rnix]

  • Refactor package layout to use pyproject.toml and implicit namespace packages. [rnix]

  • Drop Python 2 support. Python >= 3.10 is required. [rnix]

1.3.0 (2019-02-05)

  • Python 3 comaptibility [reinhardt]

  • Code style (black/isort) [jensens]

1.2.0 (2017-10-19)

  • Change to use libmc or pylibmc when available

  • Add option to require with bda.cache[pylibmc] or bda.cache[libmc]

1.1.2 (2009-02-10)

  • remove legacy code

1.1.1 (2009-02-10)

  • bugfix in zcml configuration.

1.1 (2009-02-09)

  • Cache Managers are now adapters.

  • Implement memcached server support

  • deprecate the default CacheManager

  • Fix tests for FSCache

1.0

  • Initial work

Metadata

Release files for bda.cache 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bda.cache 2.0.0
File Size Uploaded Provenance Actions
bda_cache-2.0.0.tar.gz 12.2 kB Without provenance Details for bda_cache-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bda.cache 2.0.0
File Interpreter ABI Platform Actions
bda_cache-2.0.0-py3-none-any.whl Python 3 none any Details for bda_cache-2.0.0-py3-none-any.whl

Total release size: 26.5 kB

Release files / bda_cache-2.0.0.tar.gz

Download URL bda_cache-2.0.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a26bdc33ca6a0cf78f0ebd53ab7fc8ca350c655d05d1dd9263e4f1f8d3949784
BLAKE2b-256 checksum
How to use checksums
32e3b79644263a44280add423b85efdf96ad4934a60225c6387727489aa93592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / bda_cache-2.0.0-py3-none-any.whl

Download URL bda_cache-2.0.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b0b27355aa0f75a6a6d940e89f74e87541810102b789c68df71494f64a5870f
BLAKE2b-256 checksum
How to use checksums
f7bae77b9ce2699c2d9661bf18389a47d09083ea33c0a1b6b91864fbc0895c56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for bda.cache 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page