3 Commits

Author SHA1 Message Date
dde8bd04de Add cache attribution and fix broken DB session methods
- Add fetched_by_key_hash column to CacheEntry model for tracking
  which Rentcast API key originally fetched each cached response
- Fix broken self.db references in SQLiteCacheBackend methods:
  - delete() now properly creates session from SessionLocal
  - clear_pattern() fixed with proper session management
  - health_check() fixed with proper session management
- Add SQL injection protection in clear_pattern() by escaping
  LIKE wildcards (%, _) before pattern conversion
- Update proxy_to_rentcast to hash and store the client's
  Rentcast API key on cache miss
- Fix httpx test client to use ASGITransport (required for httpx 0.27+)
2026-01-18 18:09:47 -07:00
525c7bb511 Complete rentcache implementation with FastAPI proxy
- Comprehensive FastAPI server proxying all Rentcast API endpoints
- Intelligent caching system with soft delete and stale-while-revalidate
- Multi-backend support (SQLite, Redis) with sophisticated cache management
- Rate limiting per API key and endpoint with exponential backoff
- Rich CLI for administration: API keys, cache management, health checks
- SQLAlchemy models: CacheEntry, APIKey, RateLimit, UsageStats
- Production middleware: CORS, compression, logging, error handling
- Health and metrics endpoints for monitoring
- Complete test suite (32% coverage, model tests passing)
- Cost management with usage tracking and estimation

Features:
- Mark cache invalid instead of delete for analytics
- Serve stale cache on API errors
- Per-endpoint TTL configuration
- Rich CLI with colors and tables
- Comprehensive monitoring and analytics
2025-09-09 14:45:35 -06:00
9a06e9d059 Initial implementation of RentCache FastAPI proxy server
- Complete FastAPI proxy server with all Rentcast API endpoints
- Intelligent caching with SQLite backend and Redis support
- Rate limiting and usage tracking per API key
- CLI administration tools for key and cache management
- Comprehensive models with SQLAlchemy for persistence
- Health checks and metrics endpoints
- Production-ready configuration management
- Extensive test coverage with pytest and fixtures
- Rich CLI interface with click and rich libraries
- Soft delete caching strategy for analytics
- TTL-based cache expiration with endpoint-specific durations
- CORS, compression, and security middleware
- Structured logging with JSON format
- Cost tracking and estimation for API usage
- Background task support architecture
- Docker deployment ready
- Comprehensive documentation and setup instructions
2025-09-09 14:42:51 -06:00