Metadata-Version: 2.1
Name: memocache
Version: 0.0.3
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**


**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.
