last

package module
v0.0.0-...-8f9ccdd Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2014 License: MIT Imports: 6 Imported by: 0

README

last

Build Status

System memory aware LRU cache in Go

Documentation on GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadSysMemStats

func ReadSysMemStats(s *SysMemStats) error

ReadSysMemStats reads the system memory statistics into s.

Types

type Cache

type Cache interface {
	//  SetMaxItems sets the maximum number of items the cache can hold to n
	SetMaxItems(n uint)

	// SetMinFreeMemory sets the minimum amount of free memory
	// in bytes before the cache starts evicting objects.
	SetMinFreeMemory(v uint64)

	// SetTimeout sets a default timeout duration for cache items in milliseconds.
	SetTimeout(ms uint)

	// Put stores and pushes the item to the front of the cache.
	Put(k string, v interface{})

	// Get gets the item from the cache and pushes it to the front.
	Get(k string) (interface{}, bool)

	// Del removes the item from the cache.
	Del(k string)

	// Len returns the number of items stored in the cache.
	Len() int

	// Evict removes the oldest n items from the cache.
	Evict(n uint)
}

func New

func New() Cache

type SysMemStats

type SysMemStats struct {
	Total uint64
	Used  uint64
	Free  uint64
}

Jump to

Keyboard shortcuts

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