cache

package
v0.0.0-...-292cf52 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(key string, request requests.RPCRequest, response requests.RPCResponse) error
	Get(key string) (requests.RPCResponse, error)
	Requests() ([]requests.RPCRequest, error)
	Close() error
	Clean() error
}

Cache ...

func FromConfig

func FromConfig(ctx context.Context, c *config.Config) (Cache, error)

FromConfig initializes cache from config

type Client

type Client struct {
	*redis.Client
}

Client represents redis client

func NewRedisClient

func NewRedisClient(ctx context.Context, config config.RedisCacheSettings) (*Client, error)

NewRedisClient creates redis client

func (*Client) Clean

func (client *Client) Clean() error

Clean cleans all cache

func (*Client) Close

func (client *Client) Close() error

Close closes redis client

func (*Client) Get

func (client *Client) Get(key string) (requests.RPCResponse, error)

func (*Client) Requests

func (client *Client) Requests() ([]requests.RPCRequest, error)

func (*Client) Set

func (client *Client) Set(key string, request requests.RPCRequest, response requests.RPCResponse) error

type Error

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

Error for cache package

func (Error) Error

func (e Error) Error() string

type MemoryCache

type MemoryCache struct {
	*cache.Cache
}

MemoryCache ...

func NewMemoryCache

func NewMemoryCache(defaultExpiration, cleanupInterval time.Duration) *MemoryCache

NewMemoryCache initializes memory cache

func NewMemoryCacheDefault

func NewMemoryCacheDefault() *MemoryCache

NewMemoryCacheDefault initializes memory cache with default parameters

func NewMemoryCacheFromConfig

func NewMemoryCacheFromConfig(config config.MemoryCacheSettings) *MemoryCache

NewMemoryCacheFromConfig initializes memory cache from config

func (*MemoryCache) Clean

func (m *MemoryCache) Clean() error

Clean ...

func (*MemoryCache) Close

func (m *MemoryCache) Close() error

Close ...

func (*MemoryCache) Get

func (m *MemoryCache) Get(key string) (requests.RPCResponse, error)

Get ...

func (*MemoryCache) Requests

func (m *MemoryCache) Requests() ([]requests.RPCRequest, error)

func (*MemoryCache) Set

func (m *MemoryCache) Set(key string, request requests.RPCRequest, response requests.RPCResponse) error

Set ...

Jump to

Keyboard shortcuts

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