Package org.springframework.cache.interceptor

# Class CacheOperation

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

All Implemented Interfaces:
  `BasicOperation`

Direct Known Subclasses:
  `CacheableOperation`, `CacheEvictOperation`, `CachePutOperation`

public abstract class CacheOperation extends Object implements BasicOperation
Base class for cache operations.

Since:
  3.1
Author:
  Costin Leau, Stephane Nicoll, Marcin Kamionowski

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`CacheOperation.Builder`
Base class for builders that can be used to create a `CacheOperation`.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`CacheOperation(CacheOperation.Builder b)`
Create a new `CacheOperation` instance from the given builder.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
This implementation compares the `toString()` results.
`String`
`getCacheManager()`
`Set<String>`
`getCacheNames()`
Return the cache name(s) associated with the operation.
`String`
`getCacheResolver()`
`String`
`getCondition()`
`String`
`getKey()`
`String`
`getKeyGenerator()`
`String`
`getName()`
`int`
`hashCode()`
This implementation returns `toString()`'s hash code.
`final String`
`toString()`
Return an identifying description for this cache operation.

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### CacheOperation

protected CacheOperation(CacheOperation.Builder b)
Create a new `CacheOperation` instance from the given builder.

Since:
  4.3

## Method Details

### getName

public String getName()

### getCacheNames

public Set<String> getCacheNames()
Description copied from interface: `BasicOperation`
Return the cache name(s) associated with the operation.

Specified by:
  `getCacheNames` in interface `BasicOperation`

### getKey

public String getKey()

### getKeyGenerator

public String getKeyGenerator()

### getCacheManager

public String getCacheManager()

### getCacheResolver

public String getCacheResolver()

### getCondition

public String getCondition()

### equals

public boolean equals(@Nullable Object other)
This implementation compares the `toString()` results.

Overrides:
  `equals` in class `Object`
See Also:
  - `toString()`

### hashCode

public int hashCode()
This implementation returns `toString()`'s hash code.

Overrides:
  `hashCode` in class `Object`
See Also:
  - `toString()`

### toString

public final String toString()
Return an identifying description for this cache operation.

Returned value is produced by calling `CacheOperation.Builder.getOperationDescription()` during object construction. This method is used in `hashCode()` and `equals(java.lang.Object)`.

Overrides:
  `toString` in class `Object`
See Also:
  - `CacheOperation.Builder.getOperationDescription()`