2881099 / csredis

.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
MIT License
2.01k stars 414 forks source link

如何实现模糊搜索 #461

Closed xiaohanlaila closed 1 year ago

xiaohanlaila commented 2 years ago

大佬,请问如何实现模糊搜索功能

2881099 commented 1 year ago

RedisHelper.Scan("*" ,...

后面的参数看下 redis.cn

RedisHelper.Keys("*") 也可以,只不过会阻塞 redis-server,有风险。

如果使用 FreeRedis 就方便很多,[开源福利] FreeRedis 历时两年正式发布 v1.0 [C#.NET Redis Client]

foreach (var keys in cli.Scan("*", 10, null))
{
    Console.WriteLine(string.Join(", ", keys));
}
xiaohanlaila commented 1 year ago

好的,非常感谢