12 Commits

Author SHA1 Message Date
4e3a17ecd4 refactor(logging): Standardize logging format across components
- Update logging in cache, auth, proxy, metrics, and fixed path middleware
- Add consistent log message structure with method, path, status, and source
- Improve error logging with more descriptive and uniform messages
- Enhance log readability by using concise and informative log formats
2025-02-16 14:34:49 +08:00
1f277997d3 feat(cache): Enhance cache file management and cleanup
- Add startup cleanup of stale and temporary files
- Modify ClearCache to remove all cache files except config
- Implement cleanStaleFiles method to remove orphaned and temporary cache files
- Improve file management by tracking and cleaning unused cache entries
2025-02-16 14:22:51 +08:00
b63f38c95d feat(cache): Add persistent configuration storage for cache manager
- Implement saveConfig and loadConfig methods to persist cache settings
- Add JSON-based configuration file in cache directory
- Support loading and saving cache configuration (max age, cleanup interval, cache size)
- Handle configuration file creation and error scenarios
- Automatically save configuration after updates and load on initialization
2025-02-16 14:17:27 +08:00
5f67325055 refactor(cache): Improve cache expiration using LastAccess timestamp
- Update cache expiration check to use LastAccess instead of CreatedAt
- Reset expiration time on each cache item access
- Enhance cache management with more accurate access tracking
2025-02-16 14:12:29 +08:00
a4c4688412 feat(cache): Add dynamic cache configuration management
- Implement GetConfig and UpdateConfig methods in CacheManager
- Add cache configuration endpoints in CacheAdminHandler
- Create frontend UI for dynamically updating cache settings
- Support configurable max age, cleanup interval, and cache size
- Add input validation for cache configuration updates
2025-02-16 13:57:12 +08:00
35ea14a91f feat(cache): Add Content-Encoding support in cache management
- Update CacheItem struct to include ContentEncoding field
- Modify Put and Commit methods to store Content-Encoding header
- Enhance cache retrieval to set Content-Encoding header for cached responses
- Implement Content-Encoding preservation across proxy and mirror handlers
2025-02-15 18:16:04 +08:00
2267a27b37 feat(cache): Implement streaming cache with TeeReader for efficient response handling
- Replace full response body reading with streaming cache mechanism
- Add CreateTemp and Commit methods to CacheManager for incremental caching
- Use io.TeeReader to simultaneously write response to client and cache file
- Remove buffer pool and full body reading in proxy and mirror handlers
- Improve memory efficiency and reduce latency for large responses
- Update error handling and logging for cache-related operations
2025-02-15 17:48:13 +08:00
ffc64bb73a feat(cache): Add fixed path cache support to admin dashboard and API
- Integrate fixed path cache into cache admin handler and API endpoints
- Update cache admin dashboard to display fixed path cache statistics
- Modify cache management functions to support fixed path cache operations
- Add new cache type to frontend cache management UI
2025-02-15 17:32:27 +08:00
9c3c48f4b6 feat(cache,middleware): Enhance caching mechanism for fixed path proxy
- Modify CacheKey to use a simplified string representation of Vary headers
- Update GenerateCacheKey to handle Vary headers more efficiently
- Implement caching in FixedPathProxyMiddleware with cache hit/miss tracking
- Improve response handling by reading entire response body before writing
- Add error handling for connection-related issues during response writing
2025-02-15 17:14:29 +08:00
88726d9d8f feat(cache): Add CacheKey methods for string representation, equality, and hashing
- Implement `String()` method to generate a unique string representation of CacheKey
- Add `Equal()` method to compare CacheKey instances
- Create `Hash()` method using FNV-64a hashing algorithm for efficient key comparison
2025-02-15 17:09:00 +08:00
c4cd99a827 feat(cache): Implement comprehensive caching system for proxy requests
- Add CacheManager to handle caching for proxy and mirror handlers
- Introduce cache-related API endpoints for stats, enabling, and clearing
- Modify proxy and mirror handlers to support caching GET requests
- Remove rate limiting and simplify request handling
- Update go.mod dependencies and remove unused imports
- Add cache hit/miss headers to responses
- Enhance metrics collection for cached requests
2025-02-15 17:00:16 +08:00
68c27b544b feat(metrics): enhance metrics functionality and configuration
- Added new dependency on github.com/mattn/go-sqlite3 for improved metrics storage.
- Updated main.go to initialize metrics collector with a new database path and configuration settings.
- Enhanced config.json to include additional metrics settings such as alert configurations and latency thresholds.
- Refactored internal metrics handling to support new metrics structures and improve data retrieval.
- Introduced a new metrics history endpoint for retrieving historical data, enhancing monitoring capabilities.
- Improved UI for metrics dashboard to include historical data visualization options.
2024-12-03 17:48:11 +08:00