Hi Katia,
2017-04-04 16:44 GMT+02:00 Katia Aresti <karesti(a)redhat.com>:
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!)
This can't be the primary goal. Making it the best cluster manager would be
great though!
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.
One thing we need in vertx-infinispan is the ability to clean the multimap,
meaning removing some key/value pairs if value matches criteria.
It doesn't seem possible with this interface. At least, it misses a method
to get all the keys from this multimap. Ideally, I would like to be able to
supply a Serializable Predicate.
Cheers
Katia
Thank you for looking into this!