cache

package
v3.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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