Example usage for com.google.common.collect MapMaker maximumSize

List of usage examples for com.google.common.collect MapMaker maximumSize

Introduction

In this page you can find the example usage for com.google.common.collect MapMaker maximumSize.

Prototype

int maximumSize

To view the source code for com.google.common.collect MapMaker maximumSize.

Click Source Link

Usage

From source file:org.elasticsearch.index.cache.filter.resident.ResidentFilterCache.java

@Override
protected ConcurrentMap<Object, DocSet> buildFilterMap() {
    MapMaker mapMaker = new MapMaker();
    if (maxSize != -1) {
        mapMaker.maximumSize(maxSize);
    }/*ww  w.  j a  v a 2 s.c  o  m*/
    if (expire != null) {
        mapMaker.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
    }
    mapMaker.evictionListener(this);
    return mapMaker.makeMap();
}

From source file:org.elasticsearch.index.cache.filter.weak.WeakFilterCache.java

@Override
protected ConcurrentMap<Object, DocSet> buildFilterMap() {
    MapMaker mapMaker = new MapMaker().weakValues();
    if (maxSize != -1) {
        mapMaker.maximumSize(maxSize);
    }//  ww w. j  a v  a 2  s.c om
    if (expire != null) {
        mapMaker.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
    }
    mapMaker.evictionListener(this);
    return mapMaker.makeMap();
}

From source file:org.elasticsearch.index.cache.filter.soft.SoftFilterCache.java

@Override
protected ConcurrentMap<Object, DocSet> buildFilterMap() {
    // DocSet are not really stored with strong reference only when searching on them...
    // Filter might be stored in query cache
    MapMaker mapMaker = new MapMaker().softValues();
    if (maxSize != -1) {
        mapMaker.maximumSize(maxSize);
    }// w w  w  .  j  av a 2 s  . com
    if (expire != null && expire.nanos() > 0) {
        mapMaker.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
    }
    mapMaker.evictionListener(this);
    return mapMaker.makeMap();
}