-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Combined scan and live key readers
- Loading branch information
Showing
17 changed files
with
335 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.3.2 | ||
4.3.3-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...h-redis-core/src/main/java/com/redis/spring/batch/item/redis/reader/KeyEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.redis.spring.batch.item.redis.reader; | ||
|
||
public interface KeyEventListener<K> { | ||
|
||
void event(K key, String event, KeyNotificationStatus status); | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...-core/src/main/java/com/redis/spring/batch/item/redis/reader/KeyNotificationConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.redis.spring.batch.item.redis.reader; | ||
|
||
public interface KeyNotificationConsumer<K, V> { | ||
|
||
void accept(K channel, V message); | ||
|
||
} |
70 changes: 70 additions & 0 deletions
70
...c/main/java/com/redis/spring/batch/item/redis/reader/KeyNotificationDataTypeFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.redis.spring.batch.item.redis.reader; | ||
|
||
import java.util.function.Function; | ||
|
||
import com.redis.spring.batch.item.redis.common.DataType; | ||
|
||
public class KeyNotificationDataTypeFunction implements Function<String, DataType> { | ||
|
||
@Override | ||
public DataType apply(String event) { | ||
if (event == null) { | ||
return DataType.NONE; | ||
} | ||
String code = event.toLowerCase(); | ||
if (code.startsWith("xgroup-")) { | ||
return DataType.STREAM; | ||
} | ||
if (code.startsWith("ts.")) { | ||
return DataType.TIMESERIES; | ||
} | ||
if (code.startsWith("json.")) { | ||
return DataType.JSON; | ||
} | ||
switch (code) { | ||
case "set": | ||
case "setrange": | ||
case "incrby": | ||
case "incrbyfloat": | ||
case "append": | ||
return DataType.STRING; | ||
case "lpush": | ||
case "rpush": | ||
case "rpop": | ||
case "lpop": | ||
case "linsert": | ||
case "lset": | ||
case "lrem": | ||
case "ltrim": | ||
return DataType.LIST; | ||
case "hset": | ||
case "hincrby": | ||
case "hincrbyfloat": | ||
case "hdel": | ||
return DataType.HASH; | ||
case "sadd": | ||
case "spop": | ||
case "sinterstore": | ||
case "sunionstore": | ||
case "sdiffstore": | ||
return DataType.SET; | ||
case "zincr": | ||
case "zadd": | ||
case "zrem": | ||
case "zrembyscore": | ||
case "zrembyrank": | ||
case "zdiffstore": | ||
case "zinterstore": | ||
case "zunionstore": | ||
return DataType.ZSET; | ||
case "xadd": | ||
case "xtrim": | ||
case "xdel": | ||
case "xsetid": | ||
return DataType.STREAM; | ||
default: | ||
return DataType.NONE; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.