Metadata-Version: 2.1
Name: memocache
Version: 0.0.2
Summary: A decorator that optimizes function execution by caching results. With support for different eviction strategies (LFU, LRU, FIFO).
Home-page: https://github.com/BrunoCiccarino/standlib
Author: BrunoCiccarino
Author-email: ciccabr9@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

**Module: memo**

.. image:: https://img.shields.io/badge/python-v3.6%7C3.7%7C3.8%7C3.9%7C3.10%7C3.11%7C3.12-blue
   :target: https://pypi.org/project/memocache/
   :alt: Static Badge

.. image:: https://img.shields.io/pypi/l/memocache
   :target: https://pypi.org/project/memocache/
   :alt: PyPI - License

**Description:**
This module provides a `memo` decorator that implements a caching mechanism for function results. The goal is to optimize performance by avoiding redundant calculations.

**Features:**
* **Cache:** Stores function call results in a local file.
* **Eviction strategies:** Supports various eviction strategies (LRU, LFU, FIFO) to manage cache size.
* **Serialization:** Uses serialization to store various data types in the cache.
* **Synchronization:** Implements synchronization mechanisms to ensure cache integrity in multi-threaded environments.

**Usage:**
```python
from memo import memo

@memo(strategy='lru', max_size=500)
def fibonacci(n):
    if n < 2:
        return n
    return fibonacci(n-1) + fibonacci(n-2)```

**Decorator parameters**:

* strategy: Eviction strategy (lru, lfu, fifo).
* max_size: Maximum cache size.
* ttl: Time-to-live of items in the cache (in seconds).
* Internal structure:

* cache_class: Class representing the cache (LRUCache, LFUCache, FIFOCache).
* evictor: Object responsible for managing cache item eviction.
* serialize/deserialize: Functions for serializing and deserializing data.
* cache_lock: Synchronization mechanism for cache access.
