Package org.springframework.cache.interceptor

# Class SimpleKeyGenerator

java.lang.Object
org.springframework.cache.interceptor.SimpleKeyGenerator

All Implemented Interfaces:
  `KeyGenerator`

public class SimpleKeyGenerator extends Object implements KeyGenerator
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 `ConcurrentMapCache`, however, might not be suitable for all `Cache` implementations.

Since:
  4.0
Author:
  Phillip Webb, Juergen Hoeller, Sebastien Deleuze
See Also:
  - `SimpleKey`
  - `CachingConfigurer`

## Constructor Summary

Constructors
Constructor
Description
`SimpleKeyGenerator()`

## Method Summary

Modifier and Type
Method
Description
`Object`
`generate(Object target, Method method, Object... params)`
Generate a key for the given method and its parameters.
`static Object`
`generateKey(Object... params)`
Generate a key based on the specified parameters.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SimpleKeyGenerator

public SimpleKeyGenerator()

## Method Details

### generate

public Object generate(Object target, Method method, Object... params)
Description copied from interface: `KeyGenerator`
Generate a key for the given method and its parameters.

Specified by:
  `generate` in interface `KeyGenerator`
Parameters:
  `target` - the target instance
  `method` - the method being called
  `params` - the method parameters (with any var-args expanded)
Returns:
  a generated key

### generateKey

public static Object generateKey(Object... params)
Generate a key based on the specified parameters.