'How to search from spring cache using where condition?

In the spring boot application let the entity is as follows

public class Employee{
   private String location;
   private String name;
   private String lastName;
}

In my service, I am using @Cachable to find all

@Cacheable(value="employees")
public List<Employee> findAll() {
  return employeeDAO.findAll();
}

How search from the cache using

findAllByLocationEqualsAndNameEquals(String location, String name) 

without making a DB call?Please suggest.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source