-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Ability to modify/filter the ID portion of the Key (Redis Cl…
…uster Hashtags) (resolves gh-454)
- Loading branch information
Showing
16 changed files
with
648 additions
and
9 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
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
8 changes: 8 additions & 0 deletions
8
redis-om-spring/src/main/java/com/redis/om/spring/id/IdAsHashTag.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,8 @@ | ||
package com.redis.om.spring.id; | ||
|
||
public class IdAsHashTag implements IdentifierFilter<Object> { | ||
@Override | ||
public String filter(Object id) { | ||
return "{" + id.toString() + "}"; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
redis-om-spring/src/main/java/com/redis/om/spring/id/IdFilter.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,18 @@ | ||
package com.redis.om.spring.id; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.*; | ||
|
||
/** | ||
* Filters an identifier before reading/saving to Redis. | ||
* | ||
* @author Brian Sam-Bodden | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) | ||
public @interface IdFilter { | ||
Class<? extends IdentifierFilter<?>> value(); | ||
} |
5 changes: 5 additions & 0 deletions
5
redis-om-spring/src/main/java/com/redis/om/spring/id/IdentifierFilter.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,5 @@ | ||
package com.redis.om.spring.id; | ||
|
||
public interface IdentifierFilter<ID> { | ||
String filter(ID id); | ||
} |
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
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
Oops, something went wrong.