* Add Dependencie Update Script * update gitea.com/lunny/levelqueue * update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-redis/redis/v8 * update github.com/hashicorp/golang-lru * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/olivere/elastic/v7 * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark
39 lines
1.1 KiB
Go
Vendored
39 lines
1.1 KiB
Go
Vendored
package simplelru
|
|
|
|
// LRUCache is the interface for simple LRU cache.
|
|
type LRUCache interface {
|
|
// Adds a value to the cache, returns true if an eviction occurred and
|
|
// updates the "recently used"-ness of the key.
|
|
Add(key, value interface{}) bool
|
|
|
|
// Returns key's value from the cache and
|
|
// updates the "recently used"-ness of the key. #value, isFound
|
|
Get(key interface{}) (value interface{}, ok bool)
|
|
|
|
// Checks if a key exists in cache without updating the recent-ness.
|
|
Contains(key interface{}) (ok bool)
|
|
|
|
// Returns key's value without updating the "recently used"-ness of the key.
|
|
Peek(key interface{}) (value interface{}, ok bool)
|
|
|
|
// Removes a key from the cache.
|
|
Remove(key interface{}) bool
|
|
|
|
// Removes the oldest entry from cache.
|
|
RemoveOldest() (interface{}, interface{}, bool)
|
|
|
|
// Returns the oldest entry from the cache. #key, value, isFound
|
|
GetOldest() (interface{}, interface{}, bool)
|
|
|
|
// Returns a slice of the keys in the cache, from oldest to newest.
|
|
Keys() []interface{}
|
|
|
|
// Returns the number of items in the cache.
|
|
Len() int
|
|
|
|
// Clears all cache entries.
|
|
Purge()
|
|
|
|
// Resizes cache, returning number evicted
|
|
Resize(int) int
|
|
}
|