cache

package
v0.8.21 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(logger *zerolog.Logger, cacheType CacheType, config CacheConfig) (cache.CacheInterface, error)

Types

type CacheConfig

type CacheConfig struct {
	BigCacheConfig  bigcache.Config `json:"bigcache"`
	RedisConfig     redis.Options   `json:"redis"`
	MemCacheServers []string        `json:"memcache_servers"`
	FreeCacheSize   int             `json:"freecache_size"`
	NatsJSConfig    NatsConfig      `json:"nats_js_config"`
	TTL             time.Duration   `json:"ttl"`
}

type CacheType

type CacheType int // definit aici ca enum
const (
	FreeCache CacheType = iota
	Redis
	MemCache
	BigCache
	NatsJSCache
)

func (CacheType) MarshalJSON

func (t CacheType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (CacheType) String

func (t CacheType) String() string

func (*CacheType) UnmarshalJSON

func (t *CacheType) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshalls a quoted json string to the enum value

type Nats

type Nats struct {
	Conn *nats.Conn
	KV   nats.KeyValue
	// contains filtered or unexported fields
}

func NewNatsJSCache

func NewNatsJSCache(logger *zerolog.Logger, cfg NatsConfig) (*Nats, error)

func (*Nats) Clear

func (n *Nats) Clear(ctx context.Context) error

func (*Nats) Delete

func (n *Nats) Delete(ctx context.Context, key interface{}) error

func (*Nats) Get

func (n *Nats) Get(ctx context.Context, key interface{}) (interface{}, error)

func (*Nats) GetType

func (n *Nats) GetType() string

func (*Nats) Invalidate

func (n *Nats) Invalidate(ctx context.Context, options store.InvalidateOptions) error

func (*Nats) Set

func (n *Nats) Set(ctx context.Context, key, object interface{}, options *store.Options) error

type NatsConfig

type NatsConfig struct {
	CAPath   string
	CertPath string
	KeyPath  string
	Address  string
	KVConfig nats.KeyValueConfig
}

Jump to

Keyboard shortcuts

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