Persistant decorator
Project description
Shelve Caching Decorator
Overview
This Python package provides a decorator leveraging Shelve for persistent caching. The decorator allows efficient caching of function results, improving performance by storing data persistently between program executions.
Features
- Persistent Caching: Utilizes Shelve for persistent storage of cached function results.
- Efficient Performance: Caches function results to avoid recomputation, enhancing performance for repeated calls.
- Easy Integration: Simple decorator syntax for easy integration with existing functions.
- Customizable: Easily configurable to cache functions with different argument combinations.
Installation
You can install the package using pip:
pip install shelve-caching-decorator
Usage
-
Decorator Application: Use the
@persistent_cachedecorator to cache function results.from shelvecache import persistent_cache @persistent_cache("cache.db") def expensive_operation(x, y): # Your expensive computation here return x * y result = expensive_operation(2, 3) # Function result cached
-
Persistent Storage: The cached results are stored in the specified Shelve file ("cache.db" in the example above), ensuring persistence between program executions.
Examples
Check the examples directory for detailed usage examples.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to customize and expand upon this README as needed for your repository!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shelve_cache-0.0.3.tar.gz.
File metadata
- Download URL: shelve_cache-0.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9433ed9581eacbf97b9ce4f0737303fcd0ba30cb794ed8ff45960c922078954c
|
|
| MD5 |
0831c8a45f6c5fe11147cb24b1946ba7
|
|
| BLAKE2b-256 |
45ce09adb25473099333f5112aa1b946e7d394e9f64816f040f39f6c394ec3ec
|
File details
Details for the file shelve_cache-0.0.3-py3-none-any.whl.
File metadata
- Download URL: shelve_cache-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
070d03db45bb84893a14f149e22c11e9d4726f43c998e9da8e3040c7ff90174e
|
|
| MD5 |
24908bfec4132e1e9d4a9fe3edf9f0eb
|
|
| BLAKE2b-256 |
07db09ac9b00f5839217bd8da9977f723c26289c313222470ca4d3eb72a0bfd6
|