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

io.github.lc.oss.commons.util.SimpleCache Maven / Gradle / Ivy

The newest version!
package io.github.lc.oss.commons.util;

import java.util.concurrent.ConcurrentHashMap;

/**
 * Basic cache implementation
 */
public class SimpleCache implements Cache {
    private final ConcurrentHashMap cache = new ConcurrentHashMap<>();

    @Override
    public void add(String key, T value) {
        this.cache.put(key, value);
    }

    @Override
    public T get(String key) {
        return this.cache.get(key);
    }

    @Override
    public void clear() {
        this.cache.clear();
    }

    @Override
    public void remove(String key) {
        this.cache.remove(key);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy