RBatch.getCache added. Comments added. #195

pull/337/head
Nikita 9 years ago
parent d3a39298a9
commit 863acb0823

@ -25,6 +25,7 @@ import org.redisson.core.RBatch;
import org.redisson.core.RBitSetAsync; import org.redisson.core.RBitSetAsync;
import org.redisson.core.RBlockingQueueAsync; import org.redisson.core.RBlockingQueueAsync;
import org.redisson.core.RBucketAsync; import org.redisson.core.RBucketAsync;
import org.redisson.core.RCacheAsync;
import org.redisson.core.RDequeAsync; import org.redisson.core.RDequeAsync;
import org.redisson.core.RHyperLogLogAsync; import org.redisson.core.RHyperLogLogAsync;
import org.redisson.core.RKeysAsync; import org.redisson.core.RKeysAsync;
@ -162,6 +163,16 @@ public class RedissonBatch implements RBatch {
return new RedissonBitSet(executorService, name); return new RedissonBitSet(executorService, name);
} }
@Override
public <K, V> RCacheAsync<K, V> getCache(String name, Codec codec) {
return new RedissonCache<K, V>(codec, executorService, name);
}
@Override
public <K, V> RCacheAsync<K, V> getCache(String name) {
return new RedissonCache<K, V>(executorService, name);
}
@Override @Override
public RScriptAsync getScript() { public RScriptAsync getScript() {
return new RedissonScript(executorService); return new RedissonScript(executorService);

@ -47,8 +47,11 @@ import io.netty.util.concurrent.FutureListener;
import io.netty.util.concurrent.Promise; import io.netty.util.concurrent.Promise;
/** /**
* Distributed and concurrent implementation of {@link java.util.concurrent.ConcurrentMap} * <p>Map-based cache with ability to set TTL for each entry via
* and {@link java.util.Map} * {@link #put(Object, Object, long, TimeUnit)} or {@link #putIfAbsent(Object, Object, long, TimeUnit)}
* And therefore has an complex lua-scripts inside.</p>
*
* <p>If TTL is not required then it's better to use {@link org.redisson.RedissonMap}.</p>
* *
* @author Nikita Koksharov * @author Nikita Koksharov
* *

@ -36,6 +36,24 @@ import io.netty.util.concurrent.Future;
*/ */
public interface RBatch { public interface RBatch {
/**
* Returns map-based cache instance with eviction support by name
* using provided codec for both cache keys and values.
*
* @param name
* @param codec
* @return
*/
<K, V> RCacheAsync<K, V> getCache(String name, Codec codec);
/**
* Returns map-based cache instance with eviction support by name.
*
* @param name
* @return
*/
<K, V> RCacheAsync<K, V> getCache(String name);
/** /**
* Returns object holder by name * Returns object holder by name
* *

@ -18,8 +18,11 @@ package org.redisson.core;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* Distributed and concurrent implementation of {@link java.util.concurrent.ConcurrentMap} * <p>Map-based cache with ability to set TTL for each entry via
* and {@link java.util.Map} * {@link #put(Object, Object, long, TimeUnit)} or {@link #putIfAbsent(Object, Object, long, TimeUnit)}
* And therefore has an complex lua-scripts inside.</p>
*
* <p>If TTL is not required then it's better to use {@link org.redisson.RedissonMap}.</p>
* *
* @author Nikita Koksharov * @author Nikita Koksharov
* *

@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
/** /**
* Async map functions * Async map-based cache functions
* *
* @author Nikita Koksharov * @author Nikita Koksharov
* *

@ -22,7 +22,7 @@ import io.netty.util.concurrent.Future;
/** /**
* Base async interface for all Redisson objects * Base async interface for all Redisson objects
* which support expiration or TTL * which supports expiration (TTL)
* *
* @author Nikita Koksharov * @author Nikita Koksharov
* *

@ -15,7 +15,6 @@
*/ */
package org.redisson.core; package org.redisson.core;
import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;

Loading…
Cancel
Save