cache

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 3 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 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

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