Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv5.

cache

package
v4.7.0+incompatibleLatest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License:Apache-2.0Imports:3Imported by:0

Details

Repository

github.com/go-git/go-git

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

func NewBufferLRU(maxSizeFileSize) *BufferLRU

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.

func (*BufferLRU)Clear

func (c *BufferLRU) Clear()

Clear the content of this buffer cache.

func (*BufferLRU)Get

func (c *BufferLRU) Get(keyint64) ([]byte,bool)

Get returns a buffer by its key. It marks the buffer as used. If the bufferis not in the cache, (nil, false) will be returned.

func (*BufferLRU)Put

func (c *BufferLRU) Put(keyint64, slice []byte)

Put puts a buffer into the cache. If the buffer is already in the cache, itwill be marked as used. Otherwise, it will be inserted. A buffers mightbe evicted to make room for the new one.

typeFileSize

type FileSizeint64
const (ByteFileSize = 1 << (iota * 10)KiByteMiByteGiByte)
const DefaultMaxSizeFileSize = 96 *MiByte

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

func NewObjectLRU(maxSizeFileSize) *ObjectLRU

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

func (c *ObjectLRU) Clear()

Clear the content of this object cache.

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.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp