ãã£ãã·ã¥ãèªä½ããã¨ãã¯ãSoftReferenceã使ãã®ãå®çªãããã public class SimpleCache<K, V> { private ConcurrentHashMap<K, SoftReference<V>> map = new ConcurrentHashMap<K, SoftReference<V>>(); public V get(K key) { SoftReference<V> ref = this.map.get(key); if (ref == null) { return null; } V value = ref.get(); if (value == null) { this.map.remove(key); return null; } return value; } public void put(K key, V value) { So
{{#tags}}- {{label}}
{{/tags}}