com.iqiny.silly.starter.cache.SillyCaffeineCache Maven / Gradle / Ivy
The newest version!
/*
* Copyright iqiny.com
*
* https://gitee.com/iqiny/silly
*
* project name:silly-spring-boot-starter
* project description:top silly project pom.xml file
*/
package com.iqiny.silly.starter.cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.iqiny.silly.core.base.SillyInitializable;
import com.iqiny.silly.core.cache.SillyCache;
import org.springframework.cache.Cache;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
/**
* 默认集成Caffeine本地缓存工具
*/
public class SillyCaffeineCache implements SillyCache, SillyInitializable {
private CaffeineCacheManager cacheManager;
@Override
public void init() {
cacheManager = new CaffeineCacheManager();
int initialCapacity = 1024;
long maximumSize = 1024;
long expireAfterWrite = 4;
Caffeine