customCacheResolver code example
Example 1: customCacheResolver
@Cacheable(value = "concerts", key = "#location.id", cacheManager = "gemfireCacheManager")
public List<Concert> findConcerts(Location location) {
...
}
@Cacheable(value = "concerts", key = "T(someType).hash(#location)", cacheResolver = "myOwnCacheResolver")
public List<Concert> findConcerts(Location location) {
...
}
@Cacheable(value = "concerts", condition = "#location.city == 'Dallas'", unless = "#location.outOfBusiness")
public List<Concert> findConcerts(Location location) {
...
}
@Cacheable(value = "concerts", key = "#result.id")
public Location saveLocation(Location location) {
...
}
Example 2: customCacheResolver
@Cacheable(value = "user-cache", key="#userSearchVO.name", condition="#supportUser == false")
public User findUser(UserSearchVO userSearchVO, boolean supportUser)
{
User foundUser = null;
...
...
...
return foundUser;
}