cache

package
v2.0.2-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: BSD-2-Clause Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheMap map[string]*Item

CacheMap store UUID, size, type, atime and ctime in separate (sorted) table for access by fileReaper

View Source
var CacheMapLock = sync.RWMutex{}

CacheMapLock lock write access to the CacheMap

Functions

func Add

func Add(ID string, size int64)

Add an entry to the Cache for ID

func Initialize

func Initialize() (err error)

Initialize find all *.data files for nodes and populate cache only call if global --is-cache=true

func Remove

func Remove(ID string) (err error)

Remove an entry to the CacheMap and the file on disk

func Touch

func Touch(ID string)

Touch update cache LRU info

Types

type Item

type Item struct {
	UUID      string    `bson:"uuid" json:"uuid" `                   // e.g. node UUID
	Access    time.Time `bson:"last_accessed" json:"last_accessed" ` // e.g. access time
	Type      string    `bson:"type" json:"type"`
	Size      int64     `bson:"size" json:"size"  `        // e.g. size in bytes
	CreatedOn time.Time `bson:"url" json:"url" yaml:"URL"` // e.g. creation of local copy
}

Item information to manage file expiration on cache servers

Jump to

Keyboard shortcuts

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