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:
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.
Metadata
Release files for memocache 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| memocache-0.0.3.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| memocache-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / memocache-0.0.3.tar.gz
| Download URL | memocache-0.0.3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67842e87193fe6c92f0b87d906d82155b2354eaccb0b85d98b4dd9b76ce26acb
|
|
BLAKE2b-256 checksum How to use checksums |
49dede47caacaaba7c6a68ade3ad1fae8866a2efc81efd708fbf85cb275f1bec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / memocache-0.0.3-py3-none-any.whl
| Download URL | memocache-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbdb3f9d558c536f90ba60b88936468a125ef7eb58703e7bb94786904856f86a
|
|
BLAKE2b-256 checksum How to use checksums |
973e689646faa9108328b49981a89ef17bb8c1ada8ade7358bc3789881e2d2c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|