MultimapCache added to RBatch object. #525

pull/537/head
Nikita 9 years ago
parent f9c1dda0e1
commit d4d954effb

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.redisson.api.RedissonReactiveClient; import org.redisson.api.RedissonReactiveClient;
import org.redisson.client.codec.Codec; import org.redisson.client.codec.Codec;
@ -75,7 +76,6 @@ import org.redisson.core.RSortedSet;
import org.redisson.core.RTopic; import org.redisson.core.RTopic;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/** /**
* Main infrastructure class allows to get access * Main infrastructure class allows to get access

@ -36,6 +36,7 @@ import org.redisson.core.RListAsync;
import org.redisson.core.RMapAsync; import org.redisson.core.RMapAsync;
import org.redisson.core.RMapCacheAsync; import org.redisson.core.RMapCacheAsync;
import org.redisson.core.RMultimapAsync; import org.redisson.core.RMultimapAsync;
import org.redisson.core.RMultimapCacheAsync;
import org.redisson.core.RQueueAsync; import org.redisson.core.RQueueAsync;
import org.redisson.core.RScoredSortedSetAsync; import org.redisson.core.RScoredSortedSetAsync;
import org.redisson.core.RScriptAsync; import org.redisson.core.RScriptAsync;
@ -261,4 +262,25 @@ public class RedissonBatch implements RBatch {
return new RedissonGeo<V>(codec, executorService, name); return new RedissonGeo<V>(codec, executorService, name);
} }
@Override
public <K, V> RMultimapCacheAsync<K, V> getSetMultimapCache(String name) {
return new RedissonSetMultimapCache<K, V>(evictionScheduler, executorService, name);
}
@Override
public <K, V> RMultimapCacheAsync<K, V> getSetMultimapCache(String name, Codec codec) {
return new RedissonSetMultimapCache<K, V>(evictionScheduler, codec, executorService, name);
}
@Override
public <K, V> RMultimapCacheAsync<K, V> getListMultimapCache(String name) {
return new RedissonListMultimapCache<K, V>(evictionScheduler, executorService, name);
}
@Override
public <K, V> RMultimapCacheAsync<K, V> getListMultimapCache(String name, Codec codec) {
return new RedissonListMultimapCache<K, V>(evictionScheduler, codec, executorService, name);
}
} }

@ -73,6 +73,29 @@ public interface RBatch {
*/ */
<K, V> RMultimapAsync<K, V> getSetMultimap(String name, Codec codec); <K, V> RMultimapAsync<K, V> getSetMultimap(String name, Codec codec);
/**
* Returns Set based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
*
* <p>If eviction is not required then it's better to use regular map {@link #getSetMultimap(String)}.</p>
*
* @param name
* @return
*/
<K, V> RMultimapCacheAsync<K, V> getSetMultimapCache(String name);
/**
* Returns Set based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
*
* <p>If eviction is not required then it's better to use regular map {@link #getSetMultimap(String, Codec)}.</p>
*
* @param name
* @return
*/
<K, V> RMultimapCacheAsync<K, V> getSetMultimapCache(String name, Codec codec);
/** /**
* Returns set-based cache instance by <code>name</code>. * Returns set-based cache instance by <code>name</code>.
* Uses map (value_hash, value) under the hood for minimal memory consumption. * Uses map (value_hash, value) under the hood for minimal memory consumption.
@ -172,6 +195,29 @@ public interface RBatch {
*/ */
<K, V> RMultimapAsync<K, V> getListMultimap(String name, Codec codec); <K, V> RMultimapAsync<K, V> getListMultimap(String name, Codec codec);
/**
* Returns List based Multimap instance by name.
* Supports key-entry eviction with a given TTL value.
*
* <p>If eviction is not required then it's better to use regular map {@link #getSetMultimap(String)}.</p>
*
* @param name
* @return
*/
<K, V> RMultimapAsync<K, V> getListMultimapCache(String name);
/**
* Returns List based Multimap instance by name
* using provided codec for both map keys and values.
* Supports key-entry eviction with a given TTL value.
*
* <p>If eviction is not required then it's better to use regular map {@link #getSetMultimap(String, Codec)}.</p>
*
* @param name
* @return
*/
<K, V> RMultimapAsync<K, V> getListMultimapCache(String name, Codec codec);
/** /**
* Returns map instance by name. * Returns map instance by name.
* *

Loading…
Cancel
Save