mirror of
https://github.com/muun/recovery.git
synced 2025-11-11 14:30:19 -05:00
Release v0.1.0
This commit is contained in:
29
vendor/github.com/lightninglabs/neutrino/cache/cache.go
generated
vendored
Normal file
29
vendor/github.com/lightninglabs/neutrino/cache/cache.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package cache
|
||||
|
||||
import "fmt"
|
||||
|
||||
var (
|
||||
// ErrElementNotFound is returned when element isn't found in the cache.
|
||||
ErrElementNotFound = fmt.Errorf("unable to find element")
|
||||
)
|
||||
|
||||
// Cache represents a generic cache.
|
||||
type Cache interface {
|
||||
// Put stores the given (key,value) pair, replacing existing value if
|
||||
// key already exists. The return value indicates whether items had to
|
||||
// be evicted to make room for the new element.
|
||||
Put(key interface{}, value Value) (bool, error)
|
||||
|
||||
// Get returns the value for a given key.
|
||||
Get(key interface{}) (Value, error)
|
||||
|
||||
// Len returns number of elements in the cache.
|
||||
Len() int
|
||||
}
|
||||
|
||||
// Value represents a value stored in the Cache.
|
||||
type Value interface {
|
||||
// Size determines how big this entry would be in the cache. For
|
||||
// example, for a filter, it could be the size of the filter in bytes.
|
||||
Size() (uint64, error)
|
||||
}
|
||||
Reference in New Issue
Block a user