All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.dengchen2020.cache.caffeine.CaffeineCache Maven / Gradle / Ivy

package io.github.dengchen2020.cache.caffeine;

import com.github.benmanes.caffeine.cache.AsyncCache;

/**
 * caffeine缓存
 * @author dengchen
 * @since 2024/5/29
 */
public class CaffeineCache extends org.springframework.cache.caffeine.CaffeineCache {

    private final CaffeineCacheHelper cacheHandler;

    public CaffeineCache(String name, AsyncCache cache, boolean allowNullValues, CaffeineCacheHelper cacheHandler) {
        super(name, cache, allowNullValues);
        this.cacheHandler = cacheHandler;
    }

    @Override
    public void evict(Object key) {
        super.evict(key);
        cacheHandler.evict(super.getName(), key);
    }

    @Override
    public void clear() {
        super.clear();
        cacheHandler.clear(super.getName());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy