add Keys() function to private cache interface for completeness.

This commit is contained in:
Raúl Kripalani 2018-11-15 18:39:38 +00:00
parent bd80609ef6
commit 390e8c3f44

View File

@ -8,12 +8,15 @@ type cache interface {
Remove(key interface{})
Contains(key interface{}) bool
Peek(key interface{}) (value interface{}, ok bool)
Keys() []interface{}
}
// noopCache is a dummy implementation that's used when the cache is disabled.
type noopCache struct {
}
var _ cache = (*noopCache)(nil)
func (*noopCache) Get(key interface{}) (value interface{}, ok bool) {
return nil, false
}
@ -31,3 +34,7 @@ func (*noopCache) Contains(key interface{}) bool {
func (*noopCache) Peek(key interface{}) (value interface{}, ok bool) {
return nil, false
}
func (*noopCache) Keys() (keys []interface{}) {
return keys
}