cache

package
v0.0.0-...-5e24cfe Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallExpiry

func CallExpiry(t time.Duration) client.CallOption

func CallOption

func CallOption(opts *Options) client.CallOption

func SetOptions

func SetOptions(ctx context.Context, opts *Options) context.Context

Types

type Cache

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

Cache for responses

func New

func New() *Cache

New returns an initialised cache.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, req client.Request) (interface{}, bool)

Get a response from the cache

func (*Cache) List

func (c *Cache) List() map[string]string

List the key value pairs in the cache

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, req client.Request, rsp interface{}, expiry time.Duration)

Set a response in the cache

type Options

type Options struct {
	// Expiry sets the cache expiry
	Expiry time.Duration
}

func GetOptions

func GetOptions(ctx context.Context) (*Options, bool)

Jump to

Keyboard shortcuts

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