cache

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: MIT Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache store element with a expired time

func New

func New(interval time.Duration) *Cache

New return *Cache

func (Cache) Get

func (c Cache) Get(key interface{}) interface{}

Get element in Cache, and drop when it expired

func (Cache) GetWithExpire added in v0.11.0

func (c Cache) GetWithExpire(key interface{}) (payload interface{}, expired time.Time)

GetWithExpire element in Cache with Expire Time

func (Cache) Put

func (c Cache) Put(key interface{}, payload interface{}, ttl time.Duration)

Put element in Cache with its ttl

Jump to

Keyboard shortcuts

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