[英]How to get the TTL of multiple Redis keys from C# StackExchange.Redis
[英]How to get Unicode string from redis cache using StackExchange.Redis in c#?
我正在使用StackExchange.Redis庫來使用Redis。 我已將Unicode字符串值設置如下。
db.StringSet(key,"धन्यवाद");
我正在嘗試使用Unicode字符串
db.StringGet(key);
但是得到????? 而不是Unicode字符串。 Redis以以下格式存儲Unicode字符串值。
\xe0\xa4\xa7\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xaf\xe0\xa4\xb5\xe0\xa4\xbe\xe0\xa4\xa6
RedisValue
具有字符串類型的隱式RedisValue
運算符。 在發送之前,它將其編碼為UTF-8
字節數組。 如果您使用Unicode
字符串,則應該自己獲取字節。
byte[] data = Encoding.Unicode.GetBytes(value);
db.StringSet(key, data);
...
data = db.StringGet(key);
value = Encoding.Unicode.GetString(data);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.