Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get retrieves a value from the cache
Get(ctx context.Context, key string) ([]byte, bool)
// Set stores a value in the cache with a TTL
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
// Delete removes a value from the cache
Delete(ctx context.Context, key string) error
// Clear removes all values from the cache
Clear(ctx context.Context) error
// Stats returns cache statistics
Stats() CacheStats
}
Cache is the interface for response caching
type CacheStats ¶
CacheStats represents cache statistics
type Config ¶
type Config struct {
// MaxSize is the maximum cache size in bytes (default: 100MB)
MaxSize int64
// MaxItems is the maximum number of items (default: 10000)
MaxItems int
// DefaultTTL is the default TTL for cached items (default: 5 minutes)
DefaultTTL time.Duration
// Enabled indicates whether caching is enabled
Enabled bool
}
Config holds cache configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a default cache configuration
Click to show internal directories.
Click to hide internal directories.