org.redisson.api.MapOptions Java Examples

The following examples show how to use org.redisson.api.MapOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedissonMapCache.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedissonMapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor,
                        String name, RedissonClient redisson, MapOptions<K, V> options, WriteBehindService writeBehindService) {
    super(commandExecutor, name, redisson, options, writeBehindService);
    if (evictionScheduler != null) {
        evictionScheduler.schedule(getName(), getTimeoutSetName(), getIdleSetName(), getExpiredChannelName(), getLastAccessTimeSetName());
    }
    this.evictionScheduler = evictionScheduler;
}
 
Example #2
Source File: RedissonMapCache.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedissonMapCache(Codec codec, EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor,
                        String name, RedissonClient redisson, MapOptions<K, V> options, WriteBehindService writeBehindService) {
    super(codec, commandExecutor, name, redisson, options, writeBehindService);
    if (evictionScheduler != null) {
        evictionScheduler.schedule(getName(), getTimeoutSetName(), getIdleSetName(), getExpiredChannelName(), getLastAccessTimeSetName());
    }
    this.evictionScheduler = evictionScheduler;
}
 
Example #3
Source File: MapWriteBehindTask.java    From redisson with Apache License 2.0 5 votes vote down vote up
public MapWriteBehindTask(String name, CommandAsyncExecutor commandExecutor, MapOptions<?, ?> options) {
    super();
    this.commandExecutor = commandExecutor;
    this.options = (MapOptions<Object, Object>) options;
    String queueName = RedissonObject.suffixName(name, "write-behind-queue");
    this.writeBehindTasks = new RedissonQueue<>(commandExecutor, queueName, null);
}
 
Example #4
Source File: WriteBehindService.java    From redisson with Apache License 2.0 5 votes vote down vote up
public MapWriteBehindTask start(String name, MapOptions<?, ?> options) {
    MapWriteBehindTask task = tasks.get(name);
    if (task != null) {
        return task;
    }
    
    task = new MapWriteBehindTask(name, executor, options);
    MapWriteBehindTask prevTask = tasks.putIfAbsent(name, task);
    if (prevTask != null) {
        task = prevTask;
    }
    task.start();
    return task;
}
 
Example #5
Source File: RedissonMap.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedissonMap(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K, V> options, WriteBehindService writeBehindService) {
    super(commandExecutor, name);
    this.redisson = redisson;
    this.options = options;
    if (options != null && options.getWriteMode() == WriteMode.WRITE_BEHIND) {
        this.writeBehindService = writeBehindService;
        writeBehindTask = writeBehindService.start(name, options);
    } else {
        this.writeBehindService = null;
        writeBehindTask = null;
    }
}
 
Example #6
Source File: RedissonMap.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedissonMap(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K, V> options, WriteBehindService writeBehindService) {
    super(codec, commandExecutor, name);
    this.redisson = redisson;
    this.options = options;
    if (options != null && options.getWriteMode() == WriteMode.WRITE_BEHIND) {
        this.writeBehindService = writeBehindService;
        writeBehindTask = writeBehindService.start(name, options);
    } else {
        this.writeBehindService = null;
        writeBehindTask = null;
    }
}
 
Example #7
Source File: RedissonMapCacheTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
protected <K, V> RMap<K, V> getWriteBehindTestMap(String name, Map<K, V> map) {
    MapOptions<K, V> options = MapOptions.<K, V>defaults()
                                .writer(createMapWriter(map))
                                .writeMode(WriteMode.WRITE_BEHIND);
    return redisson.getMapCache("test", options);        
}
 
Example #8
Source File: RedissonMapTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
protected <K, V> RMap<K, V> getWriteBehindTestMap(String name, Map<K, V> map) {
    MapOptions<K, V> options = MapOptions.<K, V>defaults()
                                .writer(createMapWriter(map))
                                .writeMode(WriteMode.WRITE_BEHIND);
    return redisson.getMap("test", options);        
}
 
Example #9
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <K, V> RMapCache<K, V> getMapCache(String name, Codec codec, MapOptions<K, V> options) {
  return new TracingRMapCache<>(redissonClient.getMapCache(name, codec, options),
      tracingRedissonHelper);
}
 
Example #10
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <K, V> RMapCache<K, V> getMapCache(String name, MapOptions<K, V> options) {
  return new TracingRMapCache<>(redissonClient.getMapCache(name, options), tracingRedissonHelper);
}
 
Example #11
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <K, V> RMap<K, V> getMap(String name,
    MapOptions<K, V> options) {
  return new TracingRMap<>(redissonClient.getMap(name, options), tracingRedissonHelper);
}
 
Example #12
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <K, V> RMap<K, V> getMap(String name, Codec codec,
    MapOptions<K, V> options) {
  return new TracingRMap<>(redissonClient.getMap(name, codec, options), tracingRedissonHelper);
}
 
Example #13
Source File: RedissonMapCacheTest.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
protected <K, V> RMap<K, V> getWriterTestMap(String name, Map<K, V> map) {
    MapOptions<K, V> options = MapOptions.<K, V>defaults().writer(createMapWriter(map));
    return redisson.getMapCache("test", options);        
}
 
Example #14
Source File: RedissonMapCacheTest.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
protected <K, V> RMap<K, V> getLoaderTestMap(String name, Map<K, V> map) {
    MapOptions<K, V> options = MapOptions.<K, V>defaults().loader(createMapLoader(map));
    return redisson.getMapCache("test", options);        
}
 
Example #15
Source File: RedissonMapTest.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
protected <K, V> RMap<K, V> getLoaderTestMap(String name, Map<K, V> map) {
    MapOptions<K, V> options = MapOptions.<K, V>defaults().loader(createMapLoader(map));
    return redisson.getMap("test", options);        
}
 
Example #16
Source File: RedissonMapTest.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
protected <K, V> RMap<K, V> getWriterTestMap(String name, Map<K, V> map) {
    MapOptions<K, V> options = MapOptions.<K, V>defaults().writer(createMapWriter(map));
    return redisson.getMap("test", options);        
}