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.4.tar.gz (3.5 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.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shelve_cache-0.0.4.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

Hashes for shelve_cache-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f139f1b85d4232a0e8ed53b9b2e42d658e0b7771cfaa960c9e08eadd8da5dce0
MD5 796f3b68208b1428f58502124a251f9b
BLAKE2b-256 84b85615924307bf5ef331c0e60c18b429263937fbda91cdb4295d1552f8b308

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shelve_cache-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9697abcc128c2a44fab66d6ba1ba0e6a853059a89c4d37d07edb7f89c75b91e8
MD5 06e6128c242b834d710826bf3760c132
BLAKE2b-256 0db19c83ba8e1712e89efb8050546928a41c4f2617ee2f8d8821f4c9a551ba51

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