cache

package
v5.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoExpiration time.Duration = -1

	DefaultExpiration time.Duration = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func New

func New(defaultExpiration, cleanupInterval time.Duration) *Cache

func (Cache) Add

func (c Cache) Add(k string, x interface{}, d time.Duration) error

func (Cache) Delete

func (c Cache) Delete(k string)

func (Cache) DeleteExpired

func (c Cache) DeleteExpired()

func (Cache) Flush

func (c Cache) Flush()

func (Cache) Get

func (c Cache) Get(k string) (interface{}, bool)

func (Cache) GetItems

func (c Cache) GetItems() map[string]Item

func (Cache) Increment

func (c Cache) Increment(k string, n int64) error

func (Cache) Item

func (c Cache) Item() map[string]Item

func (Cache) ItemCount

func (c Cache) ItemCount() int

func (Cache) OnEvicted

func (c Cache) OnEvicted(f func(string, interface{}))

func (Cache) Replace

func (c Cache) Replace(k string, x interface{}, d time.Duration) error

func (Cache) Set

func (c Cache) Set(k string, x interface{}, d time.Duration)

type Item

type Item struct {
	Object     interface{}
	Expiration int64
}

func (Item) Expired

func (item Item) Expired() bool

Jump to

Keyboard shortcuts

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