cache

package
v4.0.0-rc9+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2017 License: MIT Imports: 1 Imported by: 0

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) Clear

func (c *ObjectFIFO) Clear()

Clear the content of this object cache

func (*ObjectFIFO) Get

Get returns an object by his hash. If the object is not found in the cache, it returns nil

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL