caching

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO: Verify where these values come from?
	FixedProcessingOverheadMs = 10
	FixedStorageOverheadBytes = 100
	MaxEntryCount             = 10000
	MaxAggregatePayloadBytes  = 10000000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func New

func New(idempotent bool, requestTopic string) *Cache

New creates a new cache.

func (*Cache) Get

func (c *Cache) Get(req *mqtt.Message) (*mqtt.Message, bool)

Get returns the response for a request from the cache if available.

func (*Cache) Set

func (c *Cache) Set(
	req, res *mqtt.Message,
	expiry, ttl time.Time,
	exec time.Duration,
)

Set stores the request and response in the cache.

Jump to

Keyboard shortcuts

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