org.redisson.api.RListMultimapCache Java Examples

The following examples show how to use org.redisson.api.RListMultimapCache. 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: ListMultimapCacheExamples.java    From redisson-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    // connects to 127.0.0.1:6379 by default
    RedissonClient redisson = Redisson.create();
    
    RListMultimapCache<String, Integer> multimap = redisson.getListMultimapCache("myMultimap");
    multimap.put("1", 1);
    multimap.put("1", 2);
    multimap.put("1", 3);
    multimap.put("2", 5);
    multimap.put("2", 6);
    multimap.put("4", 7);
    
    // set ttl = 10 seconds 
    multimap.expireKey("1", 10, TimeUnit.SECONDS);
    
    RList<Integer> values1 = multimap.get("1");
    RList<Integer> values2 = multimap.get("2");
    
    boolean hasEntry = multimap.containsEntry("1", 3);
    Collection<Entry<String, Integer>> entries = multimap.entries();
    Collection<Integer> values = multimap.values();
    
    boolean isRemoved = multimap.remove("1", 3);
    List<Integer> removedValues = multimap.removeAll("1");
    
    Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
    boolean isNewKey = multimap.putAll("5", newValues);
    
    List<Integer> oldValues = multimap.replaceValues("2", newValues);
    List<Integer> allValues = multimap.getAll("2");

    long keysRemoved = multimap.fastRemove("2", "32");
    
    redisson.shutdown();
}
 
Example #2
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <K, V> RListMultimapCache<K, V> getListMultimapCache(String name) {
  return redissonClient.getListMultimapCache(name);
}
 
Example #3
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <K, V> RListMultimapCache<K, V> getListMultimapCache(String name,
    Codec codec) {
  return redissonClient.getListMultimapCache(name, codec);
}