Skip to main content

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)

Source distribution for memocache 0.0.3
File Size Uploaded
memocache-0.0.3.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for memocache 0.0.3
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page