Feature - RedissonKeys implements UnlinkByPattern and unlinkByPatternAsync methods

add method to RKeysRx and RKeysReactive interfaces

Signed-off-by: seakider <seakider@gmail.com>
pull/5949/head
seakider 8 months ago
parent db8324f5ea
commit 5461584042

@ -230,6 +230,21 @@ public interface RKeysReactive {
*/
Mono<Long> deleteByPattern(String pattern);
/**
* Unlink multiple objects by a key pattern.
*
* Uses Lua script.
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern - match pattern
* @return deleted objects amount
*/
Mono<Long> unlinkByPattern(String pattern);
/**
* Delete multiple objects by name.
*

@ -232,6 +232,21 @@ public interface RKeysRx {
*/
Single<Long> deleteByPattern(String pattern);
/**
* Unlink multiple objects by a key pattern.
*
* Uses Lua script.
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern - match pattern
* @return deleted objects amount
*/
Single<Long> unlinkByPattern(String pattern);
/**
* Delete multiple objects by name.
*

@ -135,6 +135,16 @@ public class RedissonKeysReactiveTest extends BaseReactiveTest {
Assertions.assertEquals(2, sync(redisson.getKeys().deleteByPattern("test?")).intValue());
}
@Test
public void testUnlinkByPattern() {
RBucketReactive<String> bucket = redisson.getBucket("test1");
sync(bucket.set("someValue"));
RMapReactive<String, String> map = redisson.getMap("test2");
sync(map.fastPut("1", "2"));
Assertions.assertEquals(2, sync(redisson.getKeys().unlinkByPattern("test?")).intValue());
}
@Test
public void testMassDelete() {
RBucketReactive<String> bucket = redisson.getBucket("test");

@ -62,6 +62,16 @@ public class RedissonKeysRxTest extends BaseRxTest {
Assertions.assertEquals(2, sync(redisson.getKeys().deleteByPattern("test?")).intValue());
}
@Test
public void testUnlinkByPattern() {
RBucketRx<String> bucket = redisson.getBucket("test1");
sync(bucket.set("someValue"));
RMapRx<String, String> map = redisson.getMap("test2");
sync(map.fastPut("1", "2"));
Assertions.assertEquals(2, sync(redisson.getKeys().unlinkByPattern("test?")).intValue());
}
@Test
public void testMassDelete() {
RBucketRx<String> bucket = redisson.getBucket("test");

Loading…
Cancel
Save