Question: I'm developing a web application where the backend, developed in spring boot, consumes data from a public API that returns data in JSON.
The search is done through terms, full-text (like a google), the backend receives from the application frontend to the user's query, which in turn searches the public API, waits for a response, handles the information and sends it to the frontend.
I wanted to implement the caching system in the backend, Spring Boot. 
Basically, before the spring boot makes a call to the API publishes and wait for the response, it checks on a key/value system if the search has already been done in the past, if yes, return what is in the value of the key.

The caching system:

* Key: terms of search, Value: json with API public response.
* It has to persist data, not be volatile.
* It has to be a key-value search (cache).
* It has to be updated by a system other than the described one that updates the data of the cache, verifying if the data was changed in the base (Public API).

Initially I thought of using a NoSQL database, such as mongoDB. But after investigating better, I came across Redis. What do you think is best?

I would like to ask some suggestions to implement this architecture. I'm not sure how to implement it, I doubt both Redis or MongoDB or other.

Thanks.

Answer: 
I am not sure cache will help you much in this case, because of different forms of search words.

If you need to protect your backend from multiple executions of the same query, you can use [Spring Cache](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-caching.html). 
It supports different providers including Redis and has [evict mechanism](https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/integration.html#cache-annotations-evict)
You can use MemCache. It's ready system for caching.