47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// noopCacheManager satisfies CacheManager when external cache infrastructure is unavailable.
|
|
type noopCacheManager struct{}
|
|
|
|
// NewNoopCacheManager returns a cache manager that always misses and performs no persistence.
|
|
func NewNoopCacheManager() CacheManager {
|
|
return &noopCacheManager{}
|
|
}
|
|
|
|
func (n *noopCacheManager) Get(ctx context.Context, key string) (interface{}, bool, error) {
|
|
return nil, false, nil
|
|
}
|
|
|
|
func (n *noopCacheManager) Set(ctx context.Context, key string, data interface{}, ttl time.Duration) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopCacheManager) Delete(ctx context.Context, key string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopCacheManager) DeletePattern(ctx context.Context, pattern string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopCacheManager) Clear(ctx context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopCacheManager) Warm(ctx context.Context, keys []string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopCacheManager) GetCacheStats() (*CacheStatistics, error) {
|
|
return &CacheStatistics{}, nil
|
|
}
|
|
|
|
func (n *noopCacheManager) SetCachePolicy(policy *CachePolicy) error {
|
|
return nil
|
|
}
|