Documentation ¶
Index ¶
Constants ¶
View Source
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte )
View Source
const (
MaxSize = 10 * MiByte
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object interface { Add(o plumbing.EncodedObject) Get(k plumbing.Hash) plumbing.EncodedObject Clear() }
type ObjectFIFO ¶
type ObjectFIFO struct {
// contains filtered or unexported fields
}
func NewObjectFIFO ¶
func NewObjectFIFO(size int64) *ObjectFIFO
NewObjectFIFO returns an Object cache that keeps the newest objects that fit into the specific memory size
func (*ObjectFIFO) Add ¶
func (c *ObjectFIFO) Add(o plumbing.EncodedObject)
Add adds a new object to the cache. If the object size is greater than the cache size, the object is not added.
func (*ObjectFIFO) Get ¶
func (c *ObjectFIFO) Get(k plumbing.Hash) plumbing.EncodedObject
Get returns an object by his hash. If the object is not found in the cache, it returns nil
Click to show internal directories.
Click to hide internal directories.