Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 'unless' expression for cache veto #220

Closed
wants to merge 1 commit into from

Commits on Jan 25, 2013

  1. Support 'unless' expression for cache veto

    Allow @cachable, @CachePut and equivalent XML configuration to provide
    a SpEL expression that can be used to veto putting an item into the
    cache. Unlike 'condition' the 'unless' parameter is evaluated after
    the method has been called and can therefore reference the #result.
    
    For example:
    
        @Cacheable(value="book",
            condition="#name.length < 32",
            unless="#result.hardback")
    
    This commit also allows #result to be referenced from @CacheEvict
    expressions as long as 'beforeInvocation' is false.
    
    Issue: SPR-8871
    philwebb committed Jan 25, 2013
    Configuration menu
    Copy the full SHA
    9ccb3d3 View commit details
    Browse the repository at this point in the history