Documentation ¶ Overview ¶ Copyright (c) Microsoft Corporation. Licensed under the MIT License. Index ¶ type Cache func New(clock Clock) *Cache func (c *Cache) Exec(req *mqtt.Message, cb func() (*mqtt.Message, error)) (*mqtt.Message, error) type Clock Constants ¶ This section is empty. 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(clock Clock) *Cache New creates a new cache. func (*Cache) Exec ¶ added in v0.1.1 func (c *Cache) Exec( req *mqtt.Message, cb func() (*mqtt.Message, error), ) (*mqtt.Message, error) Exec will return the cached response message, executing the provided function to produce it if necessary. A nil message with no error indicates that the request should be dropped, e.g. if it has expired or a duplicate request is already in-flight. type Clock ¶ added in v0.1.1 type Clock interface { Now() time.Time } Clock used for test dependency injection. Source Files ¶ View all Source files cache.go Click to show internal directories. Click to hide internal directories.