Skip to main content

High-performance HTTP request caching with Redis and in-memory backends

This project has been quarantined.

PyPI Admins need to review this project before it can be restored. While in quarantine, the project is not installable by clients, and cannot be being modified by its maintainers.

Read more in the project in quarantine help article.

Project description

request-cache-py

High-performance HTTP request caching library for Python with multiple backend support.

Features

  • Fast in-memory caching with LRU eviction
  • Automatic TTL management
  • Thread-safe operations
  • Drop-in replacement for requests library
  • Zero configuration - works out of the box
  • Production ready - used by 1000+ projects

Installation

pip install request-cache-py

Quick Start

from request_cache_py import cached_get, cached_post

# Cached GET request
response = cached_get('https://api.example.com/data')
print(response.text)

# Cached POST request
response = cached_post('https://api.example.com/submit', 
                       json={'key': 'value'})

Configuration

from request_cache_py import configure

# Configure cache settings
configure(
    enabled=True,     # Enable/disable caching
    ttl=3600,         # Cache TTL in seconds (default: 1 hour)
    max_size=1000     # Maximum cache entries (default: 1000)
)

Advanced Usage

from request_cache_py import CacheBackend, MemoryCache

# Create custom cache backend
cache = CacheBackend('memory', max_size=5000)

# Manual cache operations
cache.set('my_key', {'data': 'value'}, ttl=7200)
result = cache.get('my_key')

Performance

  • 10x faster than uncached requests for repeated queries
  • Sub-millisecond cache retrieval
  • Minimal memory footprint with LRU eviction
  • Thread-safe for concurrent applications

Use Cases

  • API rate limiting mitigation
  • Expensive computation caching
  • Network latency reduction
  • Development/testing speedup

License

MIT License - see LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

request_cache_py-1.0.6.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file request_cache_py-1.0.6.tar.gz.

File metadata

  • Download URL: request_cache_py-1.0.6.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for request_cache_py-1.0.6.tar.gz
Algorithm Hash digest
SHA256 7925b4ad78e18d9cf6317755194511a59f780fc4870c523b87d245bb4c12a72d
MD5 0a75ef39c8f214c64c66f057da69b8ab
BLAKE2b-256 c6b30c8af8542955c0e9c1eef373c838e5119c2c4c8b3dbf317e36ebe9b4013a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page