cache
packageThis package is not in the latest version of its module.
Details
Valid go.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeBuffer¶
type Buffer interface {// Put puts a buffer into the cache. If the buffer is already in the cache,// it will be marked as used. Otherwise, it will be inserted. Buffer might// be evicted to make room for the new one.Put(keyint64, slice []byte)// Get returns a buffer by its key. It marks the buffer as used. If the// buffer is not in the cache, (nil, false) will be returned.Get(keyint64) ([]byte,bool)// Clear clears every object from the cache.Clear()}Buffer is an interface to a buffer cache.
typeBufferLRU¶
type BufferLRU struct {MaxSizeFileSize// contains filtered or unexported fields}BufferLRU implements an object cache with an LRU eviction policy and amaximum size (measured in object size).
funcNewBufferLRU¶
NewBufferLRU creates a new BufferLRU with the given maximum size. The maximumsize will never be exceeded.
funcNewBufferLRUDefault¶
func NewBufferLRUDefault() *BufferLRU
NewBufferLRUDefault creates a new BufferLRU with the default cache size.
typeObject¶
type Object interface {// Put puts the given object into the cache. Whether this object will// actually be put into the cache or not is implementation specific.Put(oplumbing.EncodedObject)// Get gets an object from the cache given its hash. The second return value// is true if the object was returned, and false otherwise.Get(kplumbing.Hash) (plumbing.EncodedObject,bool)// Clear clears every object from the cache.Clear()}Object is an interface to a object cache.
typeObjectLRU¶
type ObjectLRU struct {MaxSizeFileSize// contains filtered or unexported fields}ObjectLRU implements an object cache with an LRU eviction policy and amaximum size (measured in object size).
funcNewObjectLRU¶
NewObjectLRU creates a new ObjectLRU with the given maximum size. The maximumsize will never be exceeded.
funcNewObjectLRUDefault¶
func NewObjectLRUDefault() *ObjectLRU
NewObjectLRUDefault creates a new ObjectLRU with the default cache size.
func (*ObjectLRU)Get¶
Get returns an object by its hash. It marks the object as used. If the objectis not in the cache, (nil, false) will be returned.
func (*ObjectLRU)Put¶
func (c *ObjectLRU) Put(objplumbing.EncodedObject)
Put puts an object into the cache. If the object is already in the cache, itwill be marked as used. Otherwise, it will be inserted. A single object mightbe evicted to make room for the new object.