Interface ContextKeyGen
- All Superinterfaces:
org.springframework.cache.interceptor.KeyGenerator
public interface ContextKeyGen
extends org.springframework.cache.interceptor.KeyGenerator
KeyGenerator
to use with Spring Cache for method response caching that needs to take into
account DataRouteContext
as part of the cache key determination. Cache situations that
employ repository data from common libraries will be the primary consumer of this pattern when
being run with data routing enabled as part of a uber service configuration. For example, caching
translation fetch responses would require use of this key generator.- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
applyKeyFromArg
(Object param, int position, com.fasterxml.jackson.databind.node.ObjectNode node) Given a method param filtered as part ofgetArgs(Object...)
, return the key fragment as a String.default Object
default Object
default Object
generateWithPrefix
(String prefix, Object... params) default Object[]
Give the method call params passed, which params should be used in cache key determination.default String
-
Method Details
-
generate
- Specified by:
generate
in interfaceorg.springframework.cache.interceptor.KeyGenerator
-
generate
-
generateWithPrefix
-
getRouteKey
-
getArgs
Give the method call params passed, which params should be used in cache key determination.- Parameters:
params
- All the params passed to the method call- Returns:
- The filtered list of params that should be considered for this cache key determination
-
applyKeyFromArg
default void applyKeyFromArg(Object param, int position, com.fasterxml.jackson.databind.node.ObjectNode node) Given a method param filtered as part ofgetArgs(Object...)
, return the key fragment as a String. Implementors have an opportunity to refine the key value here based on the method param. For example, an implementation could return thecontextId
for an entity passed as a param.- Parameters:
param
- The filtered method paramposition
- The position of the parameter in the method signature
-