Skip to main content

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

  1. 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
    
  2. 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

shelve_cache-0.0.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shelve_cache-0.0.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file shelve_cache-0.0.2.tar.gz.

File metadata

  • Download URL: shelve_cache-0.0.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for shelve_cache-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1e7ea17359e3028826e01643b73366e507fe3bfd10f2d8e6583c38a062ad1f84
MD5 3e4be6577c776f79e29500890db3814e
BLAKE2b-256 04af0c303dbad841ffc2fe4238ada949e6e50c42ebad3a4727ca9ca9b6bae92a

See more details on using hashes here.

File details

Details for the file shelve_cache-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: shelve_cache-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for shelve_cache-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e33089e0789ee5ad7148981d8c16adf63cc43365b81885c434335a68158917a1
MD5 0ac2b369c4971f5a1bf4a15f27057275
BLAKE2b-256 67f032c3f94eea25513683a9ab5ba04c858ddaced311b1dfc5b014ca46d28f27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page