cache

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

isc-gobase/cache

cache is an in-memory key:value store/cache similar to memcached that is suitable for applications running on a single machine.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *cache

func NewWithCleanupInterval

func NewWithCleanupInterval(cleanupInterval time.Duration) *cache

func NewWithExpiration

func NewWithExpiration(expiration time.Duration) *cache

func NewWithExpirationAndCleanupInterval

func NewWithExpirationAndCleanupInterval(defaultExpiration, cleanupInterval time.Duration) *cache

Types

type Cache

type Cache *cache

type Item

type Item struct {
	//data
	Data any
	//ttl time.UnixNano.Expiration of Item,if it is -1,it will be not Expired
	Ttl 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