cache

package
v1.0.0-...-34f284f Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(key string, value any, sec time.Duration) bool

Add Store an item in the cache if the key does not exist.

func ClearPrefix

func ClearPrefix(delPrefix string) error

Clear cache key prefix.

func Flush

func Flush() bool

Flush Remove all items from the cache.

func Forever

func Forever(key string, value any) bool

Forever Store an item in the cache indefinitely.

func Forget

func Forget(key string) bool

Forget Remove an item from the cache.

func Get

func Get(key string, def any) any

Get Retrieve an item from the cache by key.

func GetBool

func GetBool(key string, def bool) bool

func GetInt

func GetInt(key string, def int) int

func GetString

func GetString(key string, def string) string

func Has

func Has(key string) bool

Has Check an item exists in the cache.

func Pull

func Pull(key string, def any) any

Pull Retrieve an item from the cache and delete it.

func Put

func Put(key string, value any, sec time.Duration) error

Put Store an item in the cache for a given number of seconds.

func Remember

func Remember(key string, ttl time.Duration, callback func() any) (any, error)

Remember Get an item from the cache, or execute the given Closure and store the result.

func RememberForever

func RememberForever(key string, callback func() any) (any, error)

RememberForever Get an item from the cache, or execute the given Closure and store the result forever.

func Store

func Store(storeName string) cache.IStore

func WithContext

func WithContext(ctx context.Context) cache.IStore

Types

This section is empty.

Jump to

Keyboard shortcuts

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