What is the difference between substr command from JedisCommands and java.lang.String
What is the difference between substr command from JedisCommands and java.lang.String substr
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Redis’
substrcommand 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
substris about characters, while Redis’substris about bytes. That makes a huge difference when dealing with UTF-8 strings.