middleware

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: BSD-2-Clause Imports: 19 Imported by: 0 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 middleware provides gRPC server interceptors for the stock service.

Index

Constants

View Source
const (
	// StockCountsCacheKey is the cache key used for the CountStocks RPC response.
	StockCountsCacheKey = "stock:counts:v1"
	// StrainCacheKeyPrefix is the cache key prefix used for GetStrain RPC responses.
	StrainCacheKeyPrefix = "stock:strain:v1:"
	// PlasmidCacheKeyPrefix is the cache key prefix used for GetPlasmid RPC responses.
	PlasmidCacheKeyPrefix = "stock:plasmid:v1:"
	// DefaultStockCountsCacheTTL is the default 1-day (24-hour) TTL for cached stock responses.
	DefaultStockCountsCacheTTL = 24 * time.Hour
)

Variables

This section is empty.

Functions

func StockCountsCacheInterceptor

func StockCountsCacheInterceptor(
	store cache.Store,
	ttl time.Duration,
) grpc.UnaryServerInterceptor

StockCountsCacheInterceptor returns a grpc.UnaryServerInterceptor that caches CountStocks, GetStrain, and GetPlasmid responses for ttl (or DefaultStockCountsCacheTTL when ttl <= 0) and invalidates cached entries after successful stock mutation RPCs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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