When I save a string to redis using ServiceStack.Redis:
client.Add("key1","abc");
While fetching the value, it returns:
client.GetValue("key1");
it returns
"\"abc\""
How do I get the complete string?
Thanks
When I save a string to redis using ServiceStack.Redis:
client.Add("key1","abc");
While fetching the value, it returns:
client.GetValue("key1");
it returns
"\"abc\""
How do I get the complete string?
Thanks
It appears as though the client.Add()
method converts the value to a string (even strings) and wraps them in quotes. The client.SetValue()
method only accepts strings and does not wrap them in quotes.
One option would be to convert the value into a string yourself. Either via the common ToString()
method, or another method to get the needed string from the object.
If the Add()
method is necessary however. You could opt to check if the string is wrapped in quotes when you get it via GetValue()
and if so, remove them.
Redis converts string to JSON when saving, that's why it's wrapped in quotes.
So you have to treat this string as JSON object and parse it afterwards manually or using deserialization.