cacher

package
v0.0.0-...-1bfa4a9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(dispatcher phi.Sender, logger logrus.FieldLogger, ttl kv.Table, opts phi.Options, db db.DB) phi.Task

New constructs a new `Cacher` as a `phi.Task` which can be `Run()`.

Types

type Cacher

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

Cacher is a task responsible for caching responses for corresponding requests. Upon receiving a request it will check its cache to see if it has a cached response. If it does, it will write this immediately as a response, otherwise it will forward the request on to the `Dispatcher`. Once the `Dispatcher` has a response ready, the `Cacher` will store this response in its cache with a key derived from the request, and then pass the response along to be given to the client.

func (*Cacher) Handle

func (cacher *Cacher) Handle(_ phi.Task, message phi.Message)

Handle implements the `phi.Handler` interface.

type ID

type ID [32]byte

ID is a key for a cached response.

func (ID) String

func (id ID) String() string

String returns the hex encoding of the ID.

Jump to

Keyboard shortcuts

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