org.redisson.api.RKeys Java Examples

The following examples show how to use org.redisson.api.RKeys. 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: RedisCache.java    From t-io with Apache License 2.0 5 votes vote down vote up
@Override
public void clear() {
	long start = SystemTimer.currTime;

	RKeys keys = redisson.getKeys();

	//		keys.deleteByPattern(keyPrefix(cacheName) + "*");
	keys.deleteByPatternAsync(keyPrefix(cacheName) + "*");

	long end = SystemTimer.currTime;
	long iv = end - start;
	log.info("clear cache {}, cost {}ms", cacheName, iv);
}
 
Example #2
Source File: UnlinkOperation.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RKeys keys = new RedissonKeys(commandExecutor);
    keys.unlinkAsync(getName());
    if (lockName != null) {
        RedissonLock lock = new RedissonLock(commandExecutor, lockName);
        lock.unlockAsync();
    }
}
 
Example #3
Source File: DeleteOperation.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RKeys keys = new RedissonKeys(commandExecutor);
    keys.deleteAsync(getName());
    if (lockName != null) {
        RedissonLock lock = new RedissonTransactionalLock(commandExecutor, lockName, transactionId);
        lock.unlockAsync();
    }
}
 
Example #4
Source File: TouchOperation.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RKeys keys = new RedissonKeys(commandExecutor);
    keys.touchAsync(getName());
    RedissonLock lock = new RedissonLock(commandExecutor, lockName);
    lock.unlockAsync();
}
 
Example #5
Source File: GlobalBloomFilterTestCase.java    From jstarcraft-nlp with Apache License 2.0 4 votes vote down vote up
@BeforeEach
public void beforeTest() {
    RKeys keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #6
Source File: GlobalBloomFilterTestCase.java    From jstarcraft-nlp with Apache License 2.0 4 votes vote down vote up
@AfterEach
public void afterTest() {
    RKeys keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #7
Source File: RedisCacheTest.java    From gcp-token-broker with Apache License 2.0 4 votes vote down vote up
@After
public void teardown() {
    // Clear the database
    RKeys keys = client.getKeys();
    keys.flushdb();
}
 
Example #8
Source File: RedisQualityAttributeTestCase.java    From jstarcraft-ai with Apache License 2.0 4 votes vote down vote up
@Before
public void beforeTest() {
    RKeys keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #9
Source File: RedisQualityAttributeTestCase.java    From jstarcraft-ai with Apache License 2.0 4 votes vote down vote up
@After
public void afterTest() {
    RKeys keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #10
Source File: RedisQuantityAttributeTestCase.java    From jstarcraft-ai with Apache License 2.0 4 votes vote down vote up
@Before
public void beforeTest() {
    RKeys keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #11
Source File: RedisQuantityAttributeTestCase.java    From jstarcraft-ai with Apache License 2.0 4 votes vote down vote up
@After
public void afterTest() {
    RKeys keys = redisson.getKeys();
    keys.flushdb();
}
 
Example #12
Source File: TracingRKeys.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
public TracingRKeys(RKeys keys, TracingRedissonHelper tracingRedissonHelper) {
  this.keys = keys;
  this.tracingRedissonHelper = tracingRedissonHelper;
}
 
Example #13
Source File: TracingRedissonClient.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public RKeys getKeys() {
  return new TracingRKeys(redissonClient.getKeys(), tracingRedissonHelper);
}
 
Example #14
Source File: RedissonTransactionalBuckets.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
public RFuture<Boolean> trySetAsync(Map<String, ?> buckets) {
    checkState();
    
    RPromise<Boolean> result = new RedissonPromise<>();
    executeLocked(result, () -> {
        Set<String> keysToSet = new HashSet<>();
        for (String key : buckets.keySet()) {
            Object value = state.get(key);
            if (value != null) {
                if (value != NULL) {
                    operations.add(new BucketsTrySetOperation(codec, (Map<String, Object>) buckets, transactionId));
                    result.trySuccess(false);
                    return;
                }
            } else {
                keysToSet.add(key);
            }
        }
        
        if (keysToSet.isEmpty()) {
            operations.add(new BucketsTrySetOperation(codec, (Map<String, Object>) buckets, transactionId));
            state.putAll(buckets);
            result.trySuccess(true);
            return;
        }
        
        RKeys keys = new RedissonKeys(commandExecutor);
        String[] ks = keysToSet.toArray(new String[keysToSet.size()]);
        keys.countExistsAsync(ks).onComplete((res, e) -> {
            if (e != null) {
                result.tryFailure(e);
                return;
            }
            
            operations.add(new BucketsTrySetOperation(codec, (Map<String, Object>) buckets, transactionId));
            if (res == 0) {
                state.putAll(buckets);
                result.trySuccess(true);
            } else {
                result.trySuccess(false);
            }
        });
    }, buckets.keySet());
    return result;
}
 
Example #15
Source File: RedisOperations.java    From geowave with Apache License 2.0 4 votes vote down vote up
private void deleteByPattern(final String pattern) {
  final RKeys keySet = client.getKeys();

  keySet.getKeysByPattern(pattern).forEach(k -> keySet.delete(k));
}