Example usage for org.springframework.cache.interceptor CacheOperationExpressionEvaluator RESULT_UNAVAILABLE

List of usage examples for org.springframework.cache.interceptor CacheOperationExpressionEvaluator RESULT_UNAVAILABLE

Introduction

In this page you can find the example usage for org.springframework.cache.interceptor CacheOperationExpressionEvaluator RESULT_UNAVAILABLE.

Prototype

Object RESULT_UNAVAILABLE

To view the source code for org.springframework.cache.interceptor CacheOperationExpressionEvaluator RESULT_UNAVAILABLE.

Click Source Link

Document

Indicate that the result variable cannot be used at all.

Usage

From source file:org.springframework.cache.interceptor.CacheAspectSupport.java

private boolean hasCachePut(CacheOperationContexts contexts) {
    // Evaluate the conditions *without* the result object because we don't have it yet...
    Collection<CacheOperationContext> cachePutContexts = contexts.get(CachePutOperation.class);
    Collection<CacheOperationContext> excluded = new ArrayList<>();
    for (CacheOperationContext context : cachePutContexts) {
        try {/*from ww  w  .j a  va2  s  .co  m*/
            if (!context.isConditionPassing(CacheOperationExpressionEvaluator.RESULT_UNAVAILABLE)) {
                excluded.add(context);
            }
        } catch (VariableNotAvailableException ex) {
            // Ignoring failure due to missing result, consider the cache put has to proceed
        }
    }
    // Check if all puts have been excluded by condition
    return (cachePutContexts.size() != excluded.size());
}