cache

package
v0.0.0-...-3953a0d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instance

func Instance() interfaces.ICache

The cache can only be created once.

Types

type Cache

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

func (*Cache) Add

func (c *Cache) Add(key string, value interface{})

Add cache.

func (*Cache) AddWithExpire

func (c *Cache) AddWithExpire(key string, value interface{}, expireDuration time.Duration)

Add cache with expire time.

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete cache.

func (*Cache) Get

func (c *Cache) Get(key string) (value interface{}, ok bool)

Get value by key.If the key is expired, return "nil,false".

func (*Cache) SetMaxBytes

func (c *Cache) SetMaxBytes(maxBytes int64)

Set the cache can use max bytes.

Jump to

Keyboard shortcuts

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