In this post under Spring Caching, I will show with example how to create custom cache key from method name using SpEL. In SpEL, to access SpEL context object we will use “#root” variable. This SpEL context object will have below information reference to target method that is annotated with @Cacheable, @CachePut, or @CacheEvict reference…… Continue reading Creating custom cache key from method name using SpEL
Category: Spring Caching
Creating custom cache key from method arguments using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key from method arguments in SpEL. In SpEL, to access SpEL context object we will use “#root” variable. This SpEL context object will have below information reference to target method that is annotated with @Cacheable, @CachePut, or @CacheEvict reference…… Continue reading Creating custom cache key from method arguments using SpEL
Default cache key in Spring Caching
In this post under Spring Caching, I will explain with example what default cache key are used when storing data in the cache and you don’t specify your own cache key. Spring Caching out of the box determines the cache key using the method parameters. If a method has no parameters, the key will be…… Continue reading Default cache key in Spring Caching
Spring Caching Simple (@Cacheable) Example Class Level Part 2
In this post under Spring Caching, I will show with example how “@Cacheable” at class level affects the functioning of the class method. In previous post I have already explained how to enable and use caching at class level but with a class having just one single method. Below is the “Calculator” class that I…… Continue reading Spring Caching Simple (@Cacheable) Example Class Level Part 2
Spring Caching Simple (@Cacheable) Example Class Level Part 1
In this post under Spring Caching, I will show with example how to enable and use caching at class level in Spring application. For our example, we will use “Calculator” class which has “calculate” method which will perform heavy calculation. It will perform summation from 1 to 1000000. We cannot perform the calculation every time,…… Continue reading Spring Caching Simple (@Cacheable) Example Class Level Part 1
Spring Caching Simple (@Cacheable) Example Method Level
In this post under Spring Caching, I will show with example how to enable and use caching in Spring application. For our example, we will use “Calculator” class which has “calculate” method which will perform heavy calculation. It will perform summation from 1 to 1000000. We cannot perform the calculation every time, so we have…… Continue reading Spring Caching Simple (@Cacheable) Example Method Level