Skip to content

Instantly share code, notes, and snippets.

@chenyhd
Created June 9, 2019 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenyhd/54859e993331cba2d66a08273c595f4a to your computer and use it in GitHub Desktop.
Save chenyhd/54859e993331cba2d66a08273c595f4a to your computer and use it in GitHub Desktop.
Spring boot with caffeine cache
@Bean
public CaffeineCacheManager writeCacheHalfMinute() {
CaffeineCacheManager caffeineCacheManager = new CaffeineCacheManager(CacheNames.Write.HALF_MINUTE);
caffeineCacheManager.setCaffeine(Caffeine.newBuilder()
.expireAfterWrite(30, TimeUnit.SECONDS)
.maximumSize(100));
return caffeineCacheManager;
}
@chenyhd
Copy link
Author

chenyhd commented Jun 9, 2019

Use caffeine cache in spring boot project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment