pyappcache
Pyappcache is a library to make it easier to use application-level caching in Python.
-
Allows putting arbitrary Python objects into the cache
-
Uses PEP484 type hints to help you typecheck cache return values
-
Supports Memcache, Redis and SQLite
-
Supports working as a "read-through" and "write-through" cache
-
Native support for key
"namespacing" <https://github.com/memcached/memcached/wiki/ProgrammingTricks#namespacing>__ -
Provides a few handy extras
- A plugin for the
cachecontrol <https://pypi.org/project/CacheControl/>__ library so you can also use it as an HTTP cache withrequests <https://pypi.org/project/requests/>__
- A plugin for the
A simple example
.. code:: python
from datetime import date
from pyappcache.redis import RedisCache
from pyappcache.keys import Key, SimpleStringKey
cache = RedisCache()
# Annotate the type here to let mypy know this key is used for dates
key: Key[date] = SimpleStringKey("mifid start date")
cache.set(key, date(2018, 1, 3), ttl_seconds=3600)
... # later...
# This variable's type will be inferred as datetime.date
special_date = cache.get(key)
How it compares to alternatives
Using the redis/memcache/sqlite client directly
- Explicit key objects allow for type inference and encapsulation of keying
- Keys are prefix to help prevent collisions
- Optional, pluggable, compression
- Hopefully the overhead is small (not yet tested!)
- Portable between redis/memcache/sqlite, etc
dogpile.cache
~~~~~~~~~~~~~
- Explicit key objects allow for type inference and encapsulation of keying
- dogpile.cache provides locking, pyappcache does not
- Reduced temptation to use the problematic decorator pattern
- This often causes import order problems as you need to have your cache at import time
- Pyappache doesn't provide DBM/file backends, SQLite instead
Metadata
Release files for pyappcache 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyappcache-0.10.0.tar.gz | 29.8 kB | Without provenance | Details for pyappcache-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyappcache-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for pyappcache-0.10.0-py3-none-any.whl |
Total release size: 57.0 kB
Release files / pyappcache-0.10.0.tar.gz
| Download URL | pyappcache-0.10.0.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07548ead63c4e5212fd99173f9cff79cdcd65016ee058ac509c641127dafdac5
|
|
BLAKE2b-256 checksum How to use checksums |
32ad799d8f8ac81270d3e6eecfe47ab2f74ebe28fc01c33d0848c6cf54c2781a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.2
|
Release files / pyappcache-0.10.0-py3-none-any.whl
| Download URL | pyappcache-0.10.0-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bc70b56f157dd2dc894cb9b9873888659f5f5e8c372cccde2007846e1797b00
|
|
BLAKE2b-256 checksum How to use checksums |
4b6b9afde80aa23c114b5272f5a827b0c5dd84af68bdc7d22005019c48938edc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.2
|
Security for pyappcache 0.10.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.