Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("cache entry not found")
View Source
var ErrSearchNotSupported = errors.New("search functionality not supported by this cache repository")
Functions ¶
This section is empty.
Types ¶
type CacheEntry ¶
type CacheEntry struct { StatusCode int `json:"status_code"` // HTTP status code Body string `json:"body"` // Response body Headers map[string]string `json:"headers"` // Response headers CreatedAt time.Time `json:"created_at"` // Timestamp when created ExpiresAt time.Time `json:"expires_at"` // Timestamp when expires URL string `json:"url"` // Original request URL Method string `json:"method"` // Original request method }
type CacheRepository ¶
type CacheRepository interface { Get(ctx context.Context, key string) (*CacheEntry, error) Set(ctx context.Context, key string, value *CacheEntry, expiration time.Duration) error Delete(ctx context.Context, key string) error DeleteByPattern(ctx context.Context, pattern string) error FindAll(ctx context.Context) ([]*CacheEntry, error) SearchByURL(ctx context.Context, urlPattern string) ([]*CacheEntry, error) SearchByMethod(ctx context.Context, method string) ([]*CacheEntry, error) SearchExpiring(ctx context.Context, within time.Duration) ([]*CacheEntry, error) CreateIndex(ctx context.Context) error }
Click to show internal directories.
Click to hide internal directories.