[infinispan-dev] Native Infinispan Multimap support

Gustavo Fernandes gustavo at infinispan.org
Tue Apr 4 12:12:38 EDT 2017


On Tue, Apr 4, 2017 at 3:44 PM, Katia Aresti <karesti at redhat.com> wrote:

> 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.
>


Sounds a great idea! This structure could be useful internally as well, for
example in the Lucene directory, where we emulate a multimap using a
DeltaAware Set in the value + IGNORE_RETURN_VALUE flag for better
performance.


>
> 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);
>
>
What would it return here?

Gustavo


>    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/vertx/ext/cluster/infinispan/impl/
> InfinispanAsyncMultiMap.java
>
> [3] https://gist.github.com/karesti/194bb998856d4a2828d83754130ed79c
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20170404/43914e2a/attachment.html 


More information about the infinispan-dev mailing list