cn.fantasticmao.mundo.data.support.MemcacheCacheBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mundo-data Show documentation
Show all versions of mundo-data Show documentation
Mundo is a tiny and out-of-the-box component for business programming.
package cn.fantasticmao.mundo.data.support;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import net.rubyeye.xmemcached.MemcachedClient;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
/**
* MemcacheCacheBuilder
*
*
* LoadingCache<Integer, String> cache = MemcacheCacheBuilder.<Integer, String>newBuilder(memcachedClient)
* .expireTime(1, TimeUnit.HOURS)
* .keyConvert(String::valueOf)
* .build(new CacheLoader<Integer, String>() {
* public String load(@Nonnull Integer key) throws Exception {
* // do something ...
* return null;
* }
* });
*
*
* @author fantasticmao
* @version 1.0
* @since 2018/7/22
*/
public class MemcacheCacheBuilder {
private MemcachedClient memcachedClient;
private Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy