Code example for Cache

Methods: getIfPresent

0
public class GuavaCacheProvider implements EqlCacheProvider, ParamsAppliable { 
    private Cache<EqlCacheKey, Optional<Object>> guavaCache;
 
    @Override 
    public Optional<Object> getCache(EqlCacheKey cacheKey) {
        return guavaCache.getIfPresent(cacheKey);
    } 
 
    @Override 
    public void setCache(EqlCacheKey cacheKey, Object result) {
        guavaCache.put(cacheKey, Optional.fromNullable(result));
    } 
 
    @Override 
    public void applyParams(String[] params) {
        String spec = params[0];
        guavaCache = CacheBuilder.from(spec).build();
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java