Troubles, when key contains special escape
I have a method, which add data to HSET
The key of рash is the path as Path.Combine
var baseAddress =Path.Combine(address,obj.GetType().FullName);
var pattern = baseAddress + "*";
var keys = await _client.KeysAsync(pattern);
var properties = obj.GetProperties();
await _client.HSetAsync(Path.Combine(baseAddress,keys.Length.ToString()),
key,value);
In redis, the key is written including special escape as `"a\\c" (for example)
When i try to get a list of keys using KeysAsync(pattern) i get an empty list
If in the search pattern i replace all special escape (example: "a\\c" to "a\\\\c" ) i get true result
Help solve the problem?
Why in KeysAsync and HSetAsync keys are interpreted differently?
I may be wrong but I believe this is intentional. Writing keys are written as sent to Redis but when reading you have to escape the special characters. If you don't want this functionality you can always scrub special characters from your keys before writing. That's what I do.
On Tue, Oct 20, 2020 at 7:21 AM Bolg08 [email protected] wrote:
I have a method, which add data to HSET The key of рash is the path as Path.Combine
var baseAddress =Path.Combine(address,obj.GetType().FullName);
var pattern = baseAddress + "*";
var keys = await _client.KeysAsync(pattern);
var properties = obj.GetProperties();
await _client.HSetAsync(Path.Combine(baseAddress,keys.Length.ToString()),
key,value);
In redis, the key is written including special escape as `"a\c" (for example)
When i try to get a list of keys using KeysAsync(pattern) i get an empty list If in the search pattern i replace all special escape (example: "a\c" to "a\\c" ) i get true result
Help solve the problem?
Why in KeysAsync and HSetAsync keys are interpreted differently?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ctstone/csredis/issues/65, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPOK4RGNH3IGGWYTH4EIWLSLVXCXANCNFSM4SYFCJRQ .