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.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded Python 3

Shelve_Cache-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shelve_cache-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 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.1.tar.gz
Algorithm Hash digest
SHA256 f2422e4e5539d67588cdd05f18dc33f0604c26c0d0cc2091fa6025832f20ea03
MD5 d5989b5118b827d59e691656ddf5bc10
BLAKE2b-256 2a5677879b9e3f8bf2f942fde3b83ebd9e723bfd8bd15e9e55797bfcadf18677

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shelve_cache-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44fed82fc31add9c02f091e77a494bcc1aadca9f2ac448011f645cf816cdd7cb
MD5 c3c0bba089f3250caa776a47c8e739db
BLAKE2b-256 68da2dd8ed8920f8ad068e1d4caa7519540676c18b7a994ef538a3e9a3cf1cd2

See more details on using hashes here.

File details

Details for the file Shelve_Cache-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: Shelve_Cache-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57539daf2efb1ff21db52fcce1996034a5b2c384c2040e45bf85a9485d0e2e8d
MD5 845c63958b082ad2277365c4e8c11635
BLAKE2b-256 9d18bdea2a32253d5a5051a190eb646cca7b6e5c862e9d6adcff4f0144bc5599

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