dcache
A disk-based caching utility for Python functions.
Installation
pip install cache_on_disk
Usage
Basic Usage
from cache_on_disk import dcache
# For synchronous functions
@dcache
def expensive_function(x, y):
# Some expensive computation
return x + y
# For asynchronous functions
@dcache
async def async_expensive_function(x, y):
# Some expensive async computation
return x + y
With Required Arguments
You can specify which keyword arguments are required for caching:
@dcache(required_kwargs=["user_id"])
def get_user_data(user_id, include_history=False):
# This will only be cached if user_id is provided as a keyword argument
return {"user_id": user_id, "history": get_history(user_id) if include_history else None}
Custom Cache Configuration
from dcache import DCache
# Create a custom cache instance
my_cache = DCache(n_semaphore=50, cache_dir="/path/to/cache")
@my_cache
def my_function():
# This will use the custom cache configuration
pass
License
MIT
Metadata
Release files for cache-on-disk 0.5.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 |
|---|---|---|---|---|
| cache_on_disk-0.5.0.tar.gz | 5.5 kB | With provenance | Details for cache_on_disk-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cache_on_disk-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for cache_on_disk-0.5.0-py3-none-any.whl |
Total release size: 11.3 kB
Release files / cache_on_disk-0.5.0.tar.gz
| Download URL | cache_on_disk-0.5.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc7f7102f9cf68a131824ee057ff94c3a38844d8ed3206f0451cf88f9ff2b06e
|
|
BLAKE2b-256 checksum How to use checksums |
642818d83a0ff12c2494588f95369454b15153cfd1f0c8c688465a980f1c2669
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.
Transparency logRelease files / cache_on_disk-0.5.0-py3-none-any.whl
| Download URL | cache_on_disk-0.5.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
feb9e2dc96d2ed13b86ad77c540e8914713add383ceec267ece8cdc93b46f53d
|
|
BLAKE2b-256 checksum How to use checksums |
799364eeacd80c4a6c0d25dc4124b6bd96db92c073b7f636b6d467048ce12aa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.
Transparency logSecurity for cache-on-disk 0.5.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cache_on_disk-0.5.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2026.
Transparency logA 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.