What is the difference between certain JedisCommands which seem to be functionally equivalent to java.lang.String class
Question
What is the difference between substr
command from JedisCommands and java.lang.String
La solution
Redis' substr
command is performed in Redis server, so you don't need the whole string in you Java client to perform the operation.
E.g.: If it's a long string (e.g.: 1G) you don't need to fetch it all to get the first few bytes, reducing memory usage and the network connection between your Java client and Redis.
Another difference is that Java's substr
is about characters, while Redis' substr
is about bytes. That makes a huge difference when dealing with UTF-8 strings.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow