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.

  Unlike `DefaultKeyGenerator`, 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
  See Also:
    `SimpleKey`, `DefaultKeyGenerator`, `CachingConfigurer`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleKeyGenerator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `generate(Object target, Method method, Object... params)` Generate a key for the given method and its parameters.

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

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

- - ### Constructor Detail

    - #### SimpleKeyGenerator

          public SimpleKeyGenerator()

  - ### Method Detail

    - #### 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