@Override public void remove(final K key) { try { myCache.remove(key); myMap.remove(key); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void replace(K key, Collection<V> value) { try { myCache.remove(key); if (value == null || value.isEmpty()) { myMap.remove(key); } else { myMap.put(key, value); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void put(final K key, final Collection<V> value) { try { myCache.remove(key); myMap.appendData( key, new PersistentHashMap.ValueDataAppender() { public void append(DataOutput out) throws IOException { for (V v : value) { myValueExternalizer.save(out, v); } } }); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void removeFrom(final K key, final V value) { try { final Collection collection = myCache.get(key); if (collection != NULL_COLLECTION) { if (collection.remove(value)) { myCache.remove(key); if (collection.isEmpty()) { myMap.remove(key); } else { myMap.put(key, (Collection<V>) collection); } } } } catch (IOException e) { throw new RuntimeException(e); } }