Skip to content

Initial Release

Latest
Compare
Choose a tag to compare
@saviornt saviornt released this 20 Mar 11:49
· 5 commits to main since this release

CacheManager v1.0.0 – Initial Stable Release

We are excited to announce the initial stable release of CacheManager! This version introduces a robust, flexible, and extensible caching solution for Python applications, combining both local file-based caching (using shelve) and Redis-based caching.

Key Features

  • Multilayer Caching:
    Combine in-memory, disk, and Redis caching to achieve optimal performance and scalability.

  • Configurable Eviction Policies:
    Choose from LRU, LFU, and FIFO eviction strategies to tailor cache behavior to your application’s needs.

  • Advanced Caching Strategies:

    • Data Compression: Reduce storage requirements by compressing large cache objects.
    • Namespacing: Organize cache keys logically for easier management.
    • Telemetry: Monitor cache performance with built-in metrics.
    • Security & Resilience: Implement robust mechanisms for data protection and cache stability.
  • Decorator-based Caching:
    Simplify caching of expensive function calls using easy-to-apply decorators.

  • Bulk Operations:
    Efficiently manage multiple cache items simultaneously.

  • Extensive Configuration Options:
    Fine-tune TTLs, enable/disable cache layers, and set custom cache directories to suit diverse application requirements.

Installation

Install the latest version directly via pip:

pip install git+https://github.com/saviornt/cachemanager

Quick Start Example

from src.cache_manager import CacheManager
from src.cache_config import CacheConfig

# Create a cache configuration
config = CacheConfig(
    cache_ttl=300,  # 5 minutes TTL
    eviction_policy='LRU',  # Use Least Recently Used eviction
    memory_cache_enabled=True,  # Enable in-memory caching
    disk_cache_enabled=True,  # Enable disk caching
    cache_dir='./cache'  # Location for disk cache
)

# Initialize cache manager
cache = CacheManager(config)

# Set and retrieve a value from the cache
cache.set('key1', 'value1')
value = cache.get('key1')

# Using the caching decorator for an expensive operation
@cache.cached()
def expensive_operation(param):
    # Expensive computation here
    return "result based on " + str(param)

result = expensive_operation('param1')  # Cached result on subsequent calls

Advanced Usage

For more complex scenarios, such as hybrid caching with multiple layers (memory, Redis, disk), data compression, and more fine-tuned control, please refer to the detailed examples in the repository's documentation.

License

CacheManager is released under the [[MIT License]]


Thank you for choosing CacheManager. We look forward to your feedback and contributions as we continue to improve and extend this caching solution!