cache

package
v0.0.0-...-6116358 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 14 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 interface {
	// Get item from cache
	Get(key string) (*Item, error)

	// Set item to cache
	Set(key string, value *Item) error
}

type FileCache

type FileCache struct {
	// contains filtered or unexported fields
}

func NewFileCache

func NewFileCache(datadir string, name string, size int) *FileCache

func (*FileCache) Get

func (c *FileCache) Get(key string) (*Item, error)

func (*FileCache) Set

func (c *FileCache) Set(key string, value *Item) error

type Item

type Item struct {
	// when the item Expires
	Expires time.Time
	Data    []byte
}

func (*Item) SetTTL

func (i *Item) SetTTL(ttl time.Duration)

Sets the Expires field more conveniently

Jump to

Keyboard shortcuts

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