cache

package
v0.4.33 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

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