cache

package
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 8 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

Overview

Package cache provides support for caching Access API calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(parent context.Context, callerID string) context.Context

Context returns a new context annotated with the given caller ID.

func Skip

func Skip(parent context.Context) context.Context

Skip returns a context that will bypass the cache. If the context is already a skip context, it will be returned as is.

Types

type Store

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

Store caches gRPC API responses from the Access API servers.

The key for each entry is made up by hashing together the request method and message using BLAKE3. And the value is the protobuf-encoded response value.

func New

func New(dir string) *Store

New opens the database at the given directory and returns the corresponding Store.

func (*Store) DropAll

func (s *Store) DropAll() error

DropAll drops all data stored in the underlying cache database.

func (*Store) InterceptUnary

func (s *Store) InterceptUnary(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

InterceptUnary implements the gRPC middleware for caching certain Access API calls.

Jump to

Keyboard shortcuts

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