cache

package
v4.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amqp

type Amqp interface {
	Ping() error
	Consumer(queueName, topic, exchangeName string, retryDelay time.Duration) (string, error)
	Publisher(exchangeName, exchangeType string, args amqp.Table) error
	Publish(payload amqp.Publishing, exchange string) error
	Listen(queue string) (<-chan amqp.Delivery, error)
}

Amqp client

type App

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

App of package

func New

func New(config Config, redisApp Redis, amqpApp Amqp) (App, error)

New creates new App from Config

func (App) AmqpEnabled

func (a App) AmqpEnabled() bool

AmqpEnabled checks that distributed cache eviction is enabled

func (App) Enabled

func (a App) Enabled() bool

Enabled checks that requirements are met

func (App) Evict

func (a App) Evict(ctx context.Context, key string) error

Evict given key from cache

func (App) Get

func (a App) Get(ctx context.Context, key string, getter func() (interface{}, error), newObj func() interface{}) (interface{}, error)

Get an item from cache of by given getter. Refactor with generics.

func (App) ListenEvictions

func (a App) ListenEvictions(handler func(string))

ListenEvictions listens on amqp for cache eviction message

type Config

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

Config of package

func Flags

func Flags(fs *flag.FlagSet, prefix string, overrides ...flags.Override) Config

Flags adds flags for configuring package

type Redis

type Redis interface {
	Ping() error
	Load(ctx context.Context, key string) (string, error)
	Store(ctx context.Context, key string, value interface{}, duration time.Duration) error
	Delete(ctx context.Context, key string) error
}

Redis client

Jump to

Keyboard shortcuts

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