title: Spring Boot Cache List
body: <p>I have a method which returns list. List variables are coming from database and sometimes data is updating so i want to cache list but for example in every half an hour i want to clear the cache. How can i do this with Cacheable and CacheEvict method? I tried to use them in same method as annotation but it didn't work and i have nowhere to call them other than this method.</p>
  <pre><code>@Cacheable(value = &quot;apps&quot;)
  @Scheduled(cron = &quot;0 0/30 * * * ?&quot;)
  @CacheEvict(value = &quot;apps&quot;)
  public List&lt;Apps&gt; findLatestApps() {
  List&lt;Apps&gt; apps = entityManager.createNamedQuery(&quot;AppsQuery&quot;, Apps.class).getResultList();
  ...
  return Apps;
  
  }
  </code></pre>
  <p>This is where i call list method;</p>
  <pre><code>public ResponseEntity&lt;AppsResponse&gt; getLatestApps(@PathVariable String name) throws ResourceNotFoundException {
          AppsDto appsDto = appsService.findLatestApps(name);
          return new ResponseEntity&lt;&gt;(new ModelMapper().map(appsDto, AppsResponse.class), HttpStatus.OK);
      }
  </code></pre>