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.
Click to show internal directories.
Click to hide internal directories.