io.github.lc.oss.commons.util.SimpleCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of util Show documentation
Show all versions of util Show documentation
Generic Java Utility Classes
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);
}
}