|
|
@ -69,11 +69,6 @@ type CacheStorage interface { |
|
|
|
|
|
|
|
|
|
|
|
// Delete object from cache
|
|
|
|
// Delete object from cache
|
|
|
|
Delete(ctx context.Context, key string) error |
|
|
|
Delete(ctx context.Context, key string) error |
|
|
|
|
|
|
|
|
|
|
|
// Count returns the number of items in the cache.
|
|
|
|
|
|
|
|
// Optionaly a prefix can be provided to only count items with that prefix
|
|
|
|
|
|
|
|
// DO NOT USE. Not available for memcached.
|
|
|
|
|
|
|
|
Count(ctx context.Context, prefix string) (int64, error) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// RemoteCache allows Grafana to cache data outside its own process
|
|
|
|
// RemoteCache allows Grafana to cache data outside its own process
|
|
|
@ -102,11 +97,6 @@ func (ds *RemoteCache) Delete(ctx context.Context, key string) error { |
|
|
|
return ds.client.Delete(ctx, key) |
|
|
|
return ds.client.Delete(ctx, key) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Count returns the number of items in the cache.
|
|
|
|
|
|
|
|
func (ds *RemoteCache) Count(ctx context.Context, prefix string) (int64, error) { |
|
|
|
|
|
|
|
return ds.client.Count(ctx, prefix) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Run starts the backend processes for cache clients.
|
|
|
|
// Run starts the backend processes for cache clients.
|
|
|
|
func (ds *RemoteCache) Run(ctx context.Context) error { |
|
|
|
func (ds *RemoteCache) Run(ctx context.Context) error { |
|
|
|
// create new interface if more clients need GC jobs
|
|
|
|
// create new interface if more clients need GC jobs
|
|
|
@ -173,10 +163,6 @@ func (pcs *encryptedCacheStorage) Delete(ctx context.Context, key string) error |
|
|
|
return pcs.cache.Delete(ctx, key) |
|
|
|
return pcs.cache.Delete(ctx, key) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (pcs *encryptedCacheStorage) Count(ctx context.Context, prefix string) (int64, error) { |
|
|
|
|
|
|
|
return pcs.cache.Count(ctx, prefix) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type prefixCacheStorage struct { |
|
|
|
type prefixCacheStorage struct { |
|
|
|
cache CacheStorage |
|
|
|
cache CacheStorage |
|
|
|
prefix string |
|
|
|
prefix string |
|
|
@ -191,7 +177,3 @@ func (pcs *prefixCacheStorage) Set(ctx context.Context, key string, value []byte |
|
|
|
func (pcs *prefixCacheStorage) Delete(ctx context.Context, key string) error { |
|
|
|
func (pcs *prefixCacheStorage) Delete(ctx context.Context, key string) error { |
|
|
|
return pcs.cache.Delete(ctx, pcs.prefix+key) |
|
|
|
return pcs.cache.Delete(ctx, pcs.prefix+key) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (pcs *prefixCacheStorage) Count(ctx context.Context, prefix string) (int64, error) { |
|
|
|
|
|
|
|
return pcs.cache.Count(ctx, pcs.prefix+prefix) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|