mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-22 12:50:07 +08:00
add Keys() function to private cache interface for completeness.
This commit is contained in:
parent
bd80609ef6
commit
390e8c3f44
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user