title: How to customize expireAfterWrite for concrete cache if I use cacheBuilder?
body: <p>Based on <a href="https://stackoverflow.com/a/54571018/2674303">this answer</a> I try to use customized <code>expireAfterWrite</code> for &quot;customCache&quot;</p>
  <p>So my config look like this:</p>
  <pre><code>@Configuration
  @EnableCaching
  public class CaffeineCacheConfig {
  
      ...
  
      @Bean
      public CaffeineCacheManager cacheManager(Caffeine&lt;Object, Object&gt; caffeineCacheBuilder) {
          CaffeineCacheManager result = new CaffeineCacheManager();
          result.setCaffeine(caffeineCacheBuilder);
          return result;
      }
  
      @Bean
      public Caffeine&lt;Object, Object&gt; caffeineCacheBuilder() {
          return Caffeine.newBuilder()
                  .maximumSize(10000)
                  .expireAfterWrite(60, TimeUnit.SECONDS)
                  .recordStats();
      }
  
      @Bean
      public CaffeineCache customCache() {
          return new CaffeineCache(&quot;customCache&quot;,
                  Caffeine.newBuilder()
                          .maximumSize(10000)
                          .expireAfterWrite(60, TimeUnit.MINUTES)
                          .recordStats()
                          .build());
      }
  }
  </code></pre>
  <p>Then in codeBase I use:</p>
  <p>&quot;customCache&quot;</p>
  <pre><code>Cache cache = cacheManager.getCache(&quot;customCache&quot;)
  String result = cache.get(&quot;myKey&quot;, () -&gt; &quot;cachedValue&quot;)
  </code></pre>
  <p>And based on my experiments it keeps values on cache pnly 60 seconds by I expect 60 minutes.</p>
  <p>How to achieve desired result ?</p>