cache

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 5 Imported by: 1 module, 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

Overview

Package cache provides a simple interface for cache implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithNoCache added in v0.24.0

func ContextWithNoCache(parent context.Context) context.Context

ContextWithNoCache creates a new context with the no cache key/value added to the parent context.

func Key added in v0.24.0

func Key(args ...string) string

Key formats a slice of string arguments in a uniform, standard manner. Useful for when multiple parameters compose the cache key, and their order needs to remain the same.

func UseCache added in v0.24.0

func UseCache(ctx context.Context) bool

UseCache reports whether or not we can attempt to get data from the cache.

Types

type Cacher added in v0.20.0

type Cacher interface {
	Del(context.Context, ...string) error
	Get(context.Context, string) ([]byte, error)
	Set(context.Context, string, interface{}, time.Duration) error
}

Cacher defines the methods of any cache client.

func Default added in v0.23.0

func Default() Cacher

Default returns the default Cacher.

Directories

Path Synopsis
Package redis provides a wrapper around github.com/go-redis/redis, specifically to satisfy the cache.Cacher interface.
Package redis provides a wrapper around github.com/go-redis/redis, specifically to satisfy the cache.Cacher interface.

Jump to

Keyboard shortcuts

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