Skip to content

Conversation

@LifeJiggy
Copy link


PR FIXED: Clean ResponseCache Only

Hi @bbatha! 👋

PR #74 was automatically closed when I initially force-pushed with too many files (632 files instead of 3).

I've now fixed it completely:

  • Deleted the problematic branch
  • Created a fresh, clean branch from main
  • Only included ResponseCache code (no CLI, no validators, no other features)
  • All tests passing (5/5 tests )

Removed All Unwanted Features:

  • CLI tool - Completely removed
  • Key validator - Completely removed
  • Rate limiter - Completely removed
  • All other utilities - Only ResponseCache remains

Current PR Contains:

  • ResponseCache class with TTL support and LRU eviction
  • Thread-safe caching with configurable max size
  • Comprehensive test suite (5 tests, all passing ✅)
  • Clean imports in _utils/__init__.py
  • Zero external dependencies

PR Stats (Now Perfectly Clean):

  • 3 files changed
  • 162 lines added (no deletions)
  • 100% focused on response caching

ResponseCache Benefits:

  • TTL-based expiration for cached responses
  • LRU eviction when cache reaches max size
  • Thread-safe for concurrent access
  • Configurable parameters (max_size, default_ttl)
  • Easy integration with Gradient client
  • Production-ready with comprehensive testing

📝 Usage Example:

from gradient._utils import ResponseCache

cache = ResponseCache(max_size=100, default_ttl=300)

# Cache a response
cache.set("GET", "https://api.example.com/data", response_data, ttl=600)

# Retrieve from cache
cached_data = cache.get("GET", "https://api.example.com/data")

This PR now contains ONLY the ResponseCache functionality you wanted to review. No extra features, no distractions - just clean, focused caching code.

Ready for your review of the ResponseCache implementation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant