我需要在 Redis 中存储简单的实体对象 (C#)。我还需要使用二级索引和精确匹配来搜索它们。在与 Redis natvie 数据类型苦苦挣扎后,我选择尝试使用 RediSearch 来完成这项任务。
但是我找不到如何按照我需要的方式使用它。
我的目标很简单。实体数据结构非常简单。例如,我有一个Device听起来像这样的类(我省略了大多数不能被索引的字符串/整数字段,因此与示例无关):
public class Device
{
public int Id { get; set; } // primary key
public string Name { get; set; } // no indexing on this
public string SerialNumber { get; set; } // this is indexed and unique
public string ServerNode { get; set; } // this is indexed
public int Status { get; set; } // this is indexed, possible values 0..4
public string Info …Run Code Online (Sandbox Code Playgroud)