
commons.box.app.misc.LocalDataStore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-box-app Show documentation
Show all versions of commons-box-app Show documentation
Common utils for BOX projects.
The newest version!
package commons.box.app.misc;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import commons.box.app.DataInit;
import commons.box.app.DataStore;
import commons.box.util.Types;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
/**
* 基于 Guava 实现的本次 LocalStore
*/
public class LocalDataStore extends DataInit implements DataStore {
private Cache cache;
private int size = 0;
private int timeout = -1;
private TimeUnit timeUnit;
private Function provider;
public LocalDataStore() {
this(0, -1, null, null);
}
public LocalDataStore(Function provider) {
this(0, -1, null, provider);
}
public LocalDataStore(int size, int timeout, TimeUnit timeUnit) {
this(size, timeout, timeUnit, null);
}
public LocalDataStore(int size, int timeout, TimeUnit timeUnit, Function provider) {
this.size = size;
this.timeout = timeout;
this.timeUnit = timeUnit;
this.provider = provider;
}
@Override
protected void internalInit() {
CacheBuilder
© 2015 - 2025 Weber Informatics LLC | Privacy Policy