Release v0.1.0

This commit is contained in:
Manu Herrera
2019-10-01 12:22:30 -03:00
parent 41e6aad190
commit d301c63596
915 changed files with 378049 additions and 11 deletions

View 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)
}