GetterCache.java

53 lines | 1.14 kB Blame History Raw Download
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrgs.inf.prosoft.cache;

import java.util.function.Supplier;

/**
 *
 * @author romulo
 * @param <V>
 */
public class GetterCache<V> extends MultiCache<Void, V> {

    public GetterCache() {
        super();
    }

    public GetterCache(String name) {
        super(name);
    }

    public GetterCache(CachePerformance cachingPerformance) {
        super(cachingPerformance);
    }

    public void put(V value, long timeToLive) {
        super.put(null, value, timeToLive);
    }

    public void put(V value) {
        super.put(null, value);
    }

    public V get() throws KeyNotFoundException {
        return super.get(null);
    }

    public void invalidate() {
        super.invalidate(null);
    }

    public V computeIfAbsent(Supplier<V> supplier, long timeToLive) {
        return super.computeIfAbsent(null, supplier, timeToLive);
    }

    public V computeIfAbsent(Supplier<V> supplier) {
        return super.computeIfAbsent(null, supplier);
    }
}