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

com.ontology2.rdf.CacheEconomizer Maven / Gradle / Ivy

There is a newer version: 3.2
Show newest version
package com.ontology2.rdf;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

public class CacheEconomizer implements Economizer {

    final Cache items=CacheBuilder.newBuilder().maximumSize(10000).build();

    @Override
    public T economize(final T that) {
        try {
            return items.get(that,new Callable() {
                @Override
                public T call() throws Exception {
                    return that;
                }});
        } catch(ExecutionException ex) {
            throw new RuntimeException(ex);
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy