title: Retrieving Data from Cache in Spring boot Cacheable
body: <p>I want to implement two methods in service class.
  One method will take array of names as argument , will retrieve all its objects and store objects into cache.</p>
  
  <pre><code>@Cacheable(value="HeaderConfig")
  public List&lt;HeaderConfig&gt; getHeadeConfigByFieldNames(String[] fieldNames)
  {
      List&lt;HeaderConfig&gt; hcList = new ArrayList&lt;HeaderConfig&gt;();
      for (String fieldName : fieldNames) {
          hcList.add(headerConfigRepository.getHeadeConfigByFieldName(fieldName));
      }
      return hcList;
  }
  </code></pre>
  
  <p>Another method will take name as an argument and it should fetch Object from cached record,that was done in previous method.</p>
  
  <pre><code>@Cacheable(value="HeaderConfig" , key ="#fieldName")
   public HeaderConfig getHeadeConfigByFieldName(String fieldName)
  {
      System.out.println("from database");
      HeaderConfig hc = null;
      // CODE TO BE IMPLEMENTED TO GET DATA FROM CACHE
      return hc;
  }
  </code></pre>
  
  <p>Please can anyone suggest how to process here. Do I need to configure any cache manager .</p>