Top Description Constructors Methods
org.springframework.cache.interceptor

public Class SimpleKeyGenerator

extends Object
implements KeyGenerator
Class Inheritance
All Implemented Interfaces
org.springframework.cache.interceptor.KeyGenerator
Imports
java.lang.reflect.Method, java.util.Arrays, org.springframework.core.KotlinDetector

Simple key generator. Returns the parameter itself if a single non-null value is given, otherwise returns a SimpleKey of the parameters.

No collisions will occur with the keys generated by this class. The returned SimpleKey object can be safely used with a org.springframework.cache.concurrent.ConcurrentMapCache, however, might not be suitable for all org.springframework.cache.Cache implementations.

Authors
Phillip Webb, Juergen Hoeller, Sebastien Deleuze
Since
4.0
See Also
SimpleKey, org.springframework.cache.annotation.CachingConfigurer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
generate(Object
the target instance
target
,
Method
the method being called
method
,
Object...
the method parameters (with any var-args expanded)
params
)

Implements org.springframework.cache.interceptor.KeyGenerator.generate.

Generate a key for the given method and its parameters.
public static Object
generateKey(Object... params)

Generate a key based on the specified parameters.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SimpleKeyGeneratorback to summary
public SimpleKeyGenerator()

Method Detail

generateback to summary
public Object generate(Object target, Method method, Object... params)

Implements org.springframework.cache.interceptor.KeyGenerator.generate.

Doc from org.springframework.cache.interceptor.KeyGenerator.generate.

Generate a key for the given method and its parameters.

Parameters
target:Object

the target instance

method:Method

the method being called

params:Object[]

the method parameters (with any var-args expanded)

Returns:Object

a generated key

Annotations
@Override
generateKeyback to summary
public static Object generateKey(Object... params)

Generate a key based on the specified parameters.