feat: wire context store scaffolding and dht test skeleton
This commit is contained in:
46
pkg/slurp/storage/cache_manager_noop.go
Normal file
46
pkg/slurp/storage/cache_manager_noop.go
Normal file
@@ -0,0 +1,46 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user