lru

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLRU

func NewLRU(ctx libkb.LRUContext, sz int, version int, exampleObj interface{}) *Cache

func (*Cache) ClearMemory

func (c *Cache) ClearMemory()

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, lctx libkb.LRUContext, k libkb.LRUKeyer) (interface{}, error)

func (*Cache) Put

func (c *Cache) Put(ctx context.Context, lctx libkb.LRUContext, k libkb.LRUKeyer, v interface{}) error

type DiskLRU added in v1.0.46

type DiskLRU struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DiskLRU maintains a cache of files on the disk in a LRU manner.

func NewDiskLRU added in v1.0.46

func NewDiskLRU(name string, version int, maxSize int) *DiskLRU

func (*DiskLRU) ClearMemory added in v1.0.46

func (d *DiskLRU) ClearMemory(ctx context.Context, lctx libkb.LRUContext)

func (*DiskLRU) Flush added in v1.0.46

func (d *DiskLRU) Flush(ctx context.Context, lctx libkb.LRUContext) error

func (*DiskLRU) Get added in v1.0.46

func (d *DiskLRU) Get(ctx context.Context, lctx libkb.LRUContext, key string) (found bool, res DiskLRUEntry, err error)

func (*DiskLRU) Put added in v1.0.46

func (d *DiskLRU) Put(ctx context.Context, lctx libkb.LRUContext, key string, value interface{}) (evicted *DiskLRUEntry, err error)

func (*DiskLRU) Remove added in v1.0.46

func (d *DiskLRU) Remove(ctx context.Context, lctx libkb.LRUContext, key string) (err error)

func (*DiskLRU) Size added in v1.0.46

func (d *DiskLRU) Size(ctx context.Context, lctx libkb.LRUContext) (int, error)

type DiskLRUEntry added in v1.0.46

type DiskLRUEntry struct {
	Key          string
	Value        interface{}
	Ctime        time.Time
	LastAccessed time.Time
}

Jump to

Keyboard shortcuts

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