🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

request-cache-py

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Malicious code was recently detected in this package.

Affected versions:

1.0.01.0.11.0.21.0.31.0.4
+6 more

request-cache-py

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

pipPyPI
Version
1.1.0
Weekly downloads
824
Maintainers
1
Weekly downloads
 

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts