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_cache
decorator 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
Hashes for shelve_cache-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9697abcc128c2a44fab66d6ba1ba0e6a853059a89c4d37d07edb7f89c75b91e8 |
|
MD5 | 06e6128c242b834d710826bf3760c132 |
|
BLAKE2b-256 | 0db19c83ba8e1712e89efb8050546928a41c4f2617ee2f8d8821f4c9a551ba51 |