@ Override public ValueWrapper putIfAbsent ( final Object key , final Object value ) { if ( ! cache . isEnabled ( ) ) { LOGGER . warn ( "Cache {} is disabled. Cannot put value under key {}" , cache . getName ( ) , key ) ; return null ; } if ( key != null ) { final String cacheKey = getKey ( key ) ; try { LOGGER . info ( "Put '{}' under key {} to cache {}" , new Object [ ] { value , key , cache . getName ( ) } ) ; final Object store = toStoreValue ( value ) ; final boolean added = cache . add ( cacheKey , expiration , store , null ) ; return added ? null : get ( key ) ; } catch ( TimeoutException | CacheException | RuntimeException e ) { logOrThrow ( e , "An error has ocurred for cache {} and key {}" , getName ( ) , cacheKey , e ) ; } } else { LOGGER . info ( "Cannot put to cache {} because key is null" , cache . getName ( ) ) ; } return null ; }
Required by Spring 4 . 1