Documentation
¶
Index ¶
- Constants
- func Compress[M any](data M, alg CompressAlg) ([]byte, error)
- func CompressFlate(data []byte) ([]byte, error)
- func CompressGzip(data []byte) ([]byte, error)
- func CompressZlib(data []byte) ([]byte, error)
- func Decompress[M any](input interface{}, alg CompressAlg) (M, error)
- func DecompressFlate(data []byte) ([]byte, error)
- func DecompressGzip(data []byte) ([]byte, error)
- func DecompressZlib(data []byte) ([]byte, error)
- func FromBytes[M any](data []byte) (interface{}, error)
- func HandlerAfterDelete[M any](store Store[M], key string)
- func HandlerAfterGet[M any](store Store[M], key string, data M)
- func HandlerAfterSet[M any](store Store[M], key string, data M)
- func HandlerBeforeDelete[M any](store Store[M], key string)
- func HandlerBeforeGet[M any](store Store[M], key string)
- func HandlerBeforeSet[M any](store Store[M], key string, data M)
- func IsValidAlg(val CompressAlg) bool
- func Register[M any](options ...Options[M]) core.Module
- func ToBytes(data interface{}) ([]byte, error)
- type Cacher
- func (c *Cacher[M]) Clear() error
- func (c *Cacher[M]) Delete(key string) error
- func (c *Cacher[M]) Get(key string) (M, error)
- func (c *Cacher[M]) GetCtx() context.Context
- func (c *Cacher[M]) MGet(keys ...string) ([]M, error)
- func (c *Cacher[M]) MSet(data ...Params[M]) error
- func (c *Cacher[M]) Set(key string, value M, opts ...StoreOptions) error
- func (c *Cacher[M]) SetCtx(ctx context.Context)
- type CompressAlg
- type Hook
- type HookFnc
- type HookKey
- type Memory
- func (m *Memory[M]) Clear(ctx context.Context) error
- func (m *Memory[M]) Delete(ctx context.Context, key string) error
- func (m *Memory[M]) Get(ctx context.Context, key string) (M, error)
- func (m *Memory[M]) GetConnect() interface{}
- func (m *Memory[M]) GetHooks() []Hook
- func (m *Memory[M]) MGet(ctx context.Context, keys ...string) ([]M, error)
- func (m *Memory[M]) MSet(ctx context.Context, data ...Params[M]) error
- func (m *Memory[M]) Set(ctx context.Context, key string, val M, opts ...StoreOptions) error
- func (m *Memory[M]) SetOptions(option StoreOptions)
- type Options
- type Params
- type Store
- type StoreOptions
Constants ¶
View Source
const CACHE_MANAGER core.Provide = "cache_manager"
Variables ¶
This section is empty.
Functions ¶
func CompressFlate ¶
func Decompress ¶
func Decompress[M any](input interface{}, alg CompressAlg) (M, error)
func DecompressFlate ¶
func DecompressGzip ¶
func DecompressZlib ¶
func HandlerAfterDelete ¶
func HandlerAfterGet ¶
func HandlerAfterSet ¶
func HandlerBeforeDelete ¶
func HandlerBeforeGet ¶
func HandlerBeforeSet ¶
func IsValidAlg ¶
func IsValidAlg(val CompressAlg) bool
Types ¶
type Cacher ¶
type Cacher[M any] struct { Store Store[M] CompressAlg CompressAlg // contains filtered or unexported fields }
type CompressAlg ¶
type CompressAlg string
const ( CompressAlgGzip CompressAlg = "gzip" CompressAlgFlate CompressAlg = "flate" CompressAlgZlib CompressAlg = "zlib" )
type Memory ¶
type Memory[M any] struct { sync.RWMutex CompressAlg CompressAlg // contains filtered or unexported fields }
func (*Memory[M]) GetConnect ¶
func (m *Memory[M]) GetConnect() interface{}
func (*Memory[M]) SetOptions ¶
func (m *Memory[M]) SetOptions(option StoreOptions)
type Params ¶
type Params[M any] struct { Key string Val M Options StoreOptions }
type Store ¶
type Store[M any] interface { SetOptions(option StoreOptions) Get(ctx context.Context, key string) (M, error) MGet(ctx context.Context, keys ...string) ([]M, error) Set(ctx context.Context, key string, value M, opts ...StoreOptions) error MSet(ctx context.Context, data ...Params[M]) error Delete(ctx context.Context, key string) error Clear(ctx context.Context) error GetHooks() []Hook GetConnect() interface{} }
func NewInMemory ¶
func NewInMemory[M any](opt StoreOptions) Store[M]
type StoreOptions ¶
type StoreOptions struct { Ttl time.Duration CompressAlg CompressAlg Hooks []Hook }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.