Documentation
¶
Index ¶
- type Manager
- type MemoryManager
- func (m *MemoryManager) Allow(ctx context.Context, provider string, region string, model string, ...) (bool, time.Duration, error)
- func (m *MemoryManager) Disable(ctx context.Context, provider string, region string, model string, ...) error
- func (m *MemoryManager) LoadCache(ctx context.Context, key string) ([]byte, error)
- func (m *MemoryManager) SaveCache(ctx context.Context, key string, value []byte, duration time.Duration) error
- type ValkeyManager
- func (r *ValkeyManager) Allow(ctx context.Context, provider string, region string, model string, ...) (bool, time.Duration, error)
- func (r *ValkeyManager) Disable(ctx context.Context, provider string, region string, model string, ...) error
- func (r *ValkeyManager) LoadCache(ctx context.Context, key string) ([]byte, error)
- func (r *ValkeyManager) SaveCache(ctx context.Context, key string, value []byte, duration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface {
// Checks if the model in the region of the provider is allowed to be used.
// If not, returns false and the duration to wait before retrying.
Allow(ctx context.Context, provider string, region string, model string, interval time.Duration) (bool, time.Duration, error)
// Disables the model in the region of the provider for a given duration.
Disable(ctx context.Context, provider string, region string, model string, duration time.Duration) error
// Saves the cache for a given key with a given duration.
SaveCache(ctx context.Context, key string, value []byte, duration time.Duration) error
// Loads the cache for a given key.
LoadCache(ctx context.Context, key string) ([]byte, error)
}
type MemoryManager ¶
type MemoryManager struct {
// contains filtered or unexported fields
}
func NewMemoryManager ¶
func NewMemoryManager(cacheMaxBytes int64) (*MemoryManager, func())
type ValkeyManager ¶
type ValkeyManager struct {
// contains filtered or unexported fields
}
func NewValkeyManager ¶
func NewValkeyManager(client valkey.Client) *ValkeyManager
Click to show internal directories.
Click to hide internal directories.