domain

package
v0.0.0-...-8b2a8cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 3 Imported by: 0

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL