Every developer heard about special type in Java language — Enum. Most people imagine following structure when heard this word

public enum Pokemon {

indeed, this is the simpliest way to create Enum. Such structure provides us an easy view what pokemon we could use: Pikachu, Charmander and Eevee. There will be never Charizard or Snorlax. Basic configuration allows us to assign new pokemon and compare existing ones:

Pokemon pokemon = myWorld.getPokemon();if (PIKACHU == pokemon) {
System.out.println("Pokemon is Pikachu");
} else if (CHARMANDER == pokemon){
System.out.println("Pokemon is Charmander. Switching to Pikachu");

As you…

Imagine that you are running eCommerce business. And at some point you notice that page with items for sale is not quick enough so you decide to introduce cache. In order to cache the resuts you need to add @Cachable above the method.

public Status getAll(@NotNull Request request) {
return queryAllServices(request);

Now each time when getAll is called result is searched in cache and only if not found the method is executed. After method execution result is stored in cache, named items.


How does spring cache know what data to return to the caller? Since cache is…

Ksenia Klochko

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store