cache

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cache basic cache package; use allegro/bigcache

Index

Constants

This section is empty.

Variables

View Source
var Options *optionCache

Options option instance

Functions

func LoadCache

func LoadCache() error

LoadCache load cache will be called in main firstly

func LoadOptions

func LoadOptions() error

LoadOptions load default options

Types

type Cache

type Cache struct {
	*bigcache.BigCache
}

Cache cache struct

var Instance *Cache

Instance cache instance

func GetInstance

func GetInstance() *Cache

GetInstance get instance

func (*Cache) DeleteCache

func (c *Cache) DeleteCache(key string) error

DeleteCache delete cache by key

func (*Cache) Flush

func (c *Cache) Flush() error

Flush delete all cache

func (*Cache) GetCache

func (c *Cache) GetCache(key string) (string, bool)

GetCache get cache by key. It returns the cache value and ifFound

func (*Cache) GetCacheWithByte

func (c *Cache) GetCacheWithByte(key string) ([]byte, bool)

GetCacheWithByte get cache by key. It returns the cache value in byte and ifFound

func (*Cache) SetCache

func (c *Cache) SetCache(key, value string) error

SetCache set cache by key

func (*Cache) SetCacheWithByte

func (c *Cache) SetCacheWithByte(key string, value []byte) error

SetCacheWithByte set cache by key using byte data

Jump to

Keyboard shortcuts

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