Hashtag

Returns a string that maps to the current shard.

public static java.lang.String hashtag()

Returns a string that maps to the current shard according to the cluster slot mapping.

Note:
You can use the hashtag function when you need to create a key that resides on the current shard.

Parameters

None

Returns

Returns a string that maps to the current shard.

Example

The following example uses the hashtag function to calculate the hslot. The string maps to the current shard.

GearsBuilder.execute(
    "SET", 
    String.format("key{%s}", GearsBuilder.hashtag()), 
    "1"
);
RATE THIS PAGE
Back to top ↑