Hi all,
As you probably know, Will and I are working on the vert-x infinispan
integration [1], where the primary goal is to make infinispan the default
cluster management of vert-x. (yeah!)
Vert-x needs support for an Async Multimap. Today's implementation is a
wrapper on a normal Cache where only Cache Key's are used to implement the
multi map [2].
This is not very efficient, so after trying some other alternative
implementations [3] that don't fully work (injection not working), Will and
I have come to the conclusion that it might be a good idea to start having
our own native CacheMultimap. This first multimap won't support duplicate
values on key's.
As a quick start, the smallest multimap we need should implement the
following interface :
public interface CacheMultimap<K, V> {
V put(K key, V value);
Collection<V> get(K key);
boolean remove(K key, V value);
}
CacheMultimapImpl will be a wrapper on a normal Cache, similar to [3].
We could add a new method in EmbeddedCacheManager.java
<K, V> CacheMultimap<K, V> getCacheMultimap(String cacheName, boolean
createIfAbsent);
Implementation will create a cache as always and return a new
CacheMultimapImpl(cache).
What do you think ? Please fell free to suggest any other alternative or
idea.
Cheers
Katia
[1]
https://github.com/vert-x3/vertx-infinispan
[2]
https://github.com/vert-x3/vertx-infinispan/blob/master/src/main/java/io/...
[3]
https://gist.github.com/karesti/194bb998856d4a2828d83754130ed79c