cache

package
v0.0.0-...-310e17c Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedisKeyRecentlyUpdatedWidgets = "recently_updated_widgets"
)

Variables

View Source
var ErrorNotFound = errors.New("item not found in cache")

Functions

func NewRedisCache

func NewRedisCache(c *redis.Client) *redisCache

Types

type RedisCache

type RedisCache interface {
	GetWidget(serialNumber string) (*dto.Widget, error)
	// SetWidget puts widget meta data into the cache
	SetWidget(widget *dto.Widget) error

	// GetConnections retrieves the widget's connections from cache.
	GetConnections(serialNumber string) (*dto.WidgetConnections, error)
	// SetConnections updates the widget's connections with non zero sn peers in
	// provided conns object.
	SetConnections(conns *dto.WidgetConnections) error

	// UnsetConnections removes the widget's (and peers') connections from
	// cache.
	UnsetConnections(serialNumber string, ports dto.WidgetPortBitmap) error

	// RetrieveRecentUpdates returns up to numUpdates or more (SSCAN count
	// behaviour) of recent widget connection updates, removes the serial
	// numbers of retrieves widgets from recently_updated_widgets set.
	RetrieveRecentUpdates(numUpdates int) ([]*dto.WidgetConnections, error)
}

Jump to

Keyboard shortcuts

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