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

com.lyncode.jtwig.cache.impl.PersistentTemplateCacheSystem Maven / Gradle / Ivy

The newest version!
package com.lyncode.jtwig.cache.impl;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.lyncode.jtwig.cache.JtwigTemplateCacheSystem;
import com.lyncode.jtwig.content.api.Renderable;

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

public class PersistentTemplateCacheSystem implements JtwigTemplateCacheSystem {
    private Cache cache = CacheBuilder.newBuilder()
            .build();

    @Override
    public Renderable get(String key, Callable instanceProvider) {
        try {
            return cache.get(key, instanceProvider);
        } catch (ExecutionException e) {
            throw new IllegalStateException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy