SingleCache.java

37 lines | 742 B 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;

/**
 *
 * @author romulo
 * @param <K>
 * @param <V>
 */
public class SingleCache<K, V> extends MultiCache<K, V> {

    private K lastInput;

    public SingleCache() {
        super();
    }

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

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

    @Override
    public void put(K key, V value) {
        invalidate(this.lastInput);
        this.lastInput = key;
        super.put(key, value);
    }
}