middleware

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: BSD-2-Clause Imports: 19 Imported by: 0

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