cache

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheCfg added in v0.24.1

type CacheCfg struct {
	MaxItemSize int64
	MinUseCount uint64
}

type MemoryCache

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

MemoryCache uses memory for cache purpose

func NewMemoryCache

func NewMemoryCache(maxSize int64) *MemoryCache

NewMemoryCache returns instance of memory cache

func (*MemoryCache) Delete

func (c *MemoryCache) Delete(obj *object.FileObject) error

Delete remove given response from cache

func (*MemoryCache) Get

Get returns instance from cache or error (if not found in cache)

func (*MemoryCache) Set

func (c *MemoryCache) Set(obj *object.FileObject, res *response.Response) error

Set put response to cache

type RedisCache

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

RedisCache store response in redis

func NewRedis

func NewRedis(redisAddress []string, clientConfig map[string]string, cfg CacheCfg) *RedisCache

NewRedis create connection to redis and update it config from clientConfig map

func NewRedisCluster added in v0.15.0

func NewRedisCluster(redisAddress []string, clientConfig map[string]string, cfg CacheCfg) *RedisCache

func (*RedisCache) Delete

func (c *RedisCache) Delete(obj *object.FileObject) error

Delete remove response from cache

func (*RedisCache) Get

Get returns response from cache or error

func (*RedisCache) Set

func (c *RedisCache) Set(obj *object.FileObject, res *response.Response) error

Set put response into cache

type ResponseCache

type ResponseCache interface {
	Set(obj *object.FileObject, res *response.Response) error
	Get(obj *object.FileObject) (*response.Response, error)
	Delete(obj *object.FileObject) error
}

ResponseCache is interface for caching of mort responses

func Create

func Create(cacheCfg config.CacheCfg) ResponseCache

Create returns instance of Response cache

Jump to

Keyboard shortcuts

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