Java Code Examples for org.redisson.api.RMap#fastRemove()
The following examples show how to use
org.redisson.api.RMap#fastRemove() .
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: BaseMapTest.java From redisson with Apache License 2.0 | 6 votes |
@Test public void testWriteBehindFastRemove() throws InterruptedException { Map<String, String> store = new HashMap<>(); RMap<String, String> map = getWriteBehindTestMap("test", store); map.put("1", "11"); map.put("2", "22"); map.put("3", "33"); Thread.sleep(1400); map.fastRemove("1", "2", "4"); Map<String, String> expected = new HashMap<>(); expected.put("3", "33"); Thread.sleep(1400); assertThat(store).isEqualTo(expected); destroy(map); }
Example 2
Source File: BaseMapTest.java From redisson with Apache License 2.0 | 6 votes |
@Test public void testWriterFastRemove() { Map<String, String> store = new HashMap<>(); RMap<String, String> map = getWriterTestMap("test", store); map.put("1", "11"); map.put("2", "22"); map.put("3", "33"); map.fastRemove("1", "2", "4"); Map<String, String> expected = new HashMap<>(); expected.put("3", "33"); assertThat(store).isEqualTo(expected); destroy(map); }
Example 3
Source File: MapExamples.java From redisson-examples with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException { // connects to 127.0.0.1:6379 by default RedissonClient redisson = Redisson.create(); RMap<String, Integer> map = redisson.getMap("myMap"); map.put("a", 1); map.put("b", 2); map.put("c", 3); boolean contains = map.containsKey("a"); Integer value = map.get("c"); Integer updatedValue = map.addAndGet("a", 32); Integer valueSize = map.valueSize("c"); Set<String> keys = new HashSet<String>(); keys.add("a"); keys.add("b"); keys.add("c"); Map<String, Integer> mapSlice = map.getAll(keys); // use read* methods to fetch all objects Set<String> allKeys = map.readAllKeySet(); Collection<Integer> allValues = map.readAllValues(); Set<Entry<String, Integer>> allEntries = map.readAllEntrySet(); // use fast* methods when previous value is not required boolean isNewKey = map.fastPut("a", 100); boolean isNewKeyPut = map.fastPutIfAbsent("d", 33); long removedAmount = map.fastRemove("b"); redisson.shutdown(); }
Example 4
Source File: RedisValidateCodeRepository.java From fast-family-master with Apache License 2.0 | 4 votes |
@Override public void remove(String key) { RMap<String, ValidateCode> rMap = redissonClient.getMap(VALIDATE_CODE); rMap.fastRemove(key); }