Search code examples
stringredissetlimit

Redis - Is there a limit on SET for datatype STRING?


I am using the command line interface on my mac terminal to set a long string.

SET mystring "[long string]"

Now the issue is this. When i copy from my text editor the long string into the cli, the pasted string gets cut off at 4,066 characters.

I thought it could be the copy/paste buffer size of the mac terminal but i can paste stings alot longer outside of redis-cli.

And its no where near the 512 Megabytes limit for a STRING in redis.

This is similar to another questions but not the same steps. Redis cuts of the string when getting a serialized object back. Cant find any limits

thanks!


Solution

  • redis-cli uses linenoise custom library for terminal input, which happens to have hard-coded input buffer size of 4096 bytes: linenoise.c:101. You may want to write down your Redis command into a file and execute it with redis-cli --eval.