我开始编写一个应用程序,希望能够快速搜索我的数据。
我开始使用来自ServiceStack.Redis的客户端。(通过NuGet获取)
在此基础上,我编写了一个小测试应用程序,插入了20k个公司数据记录,现在我正在使用以下代码查询这个东西:
using (var companies = redisClient.As<Company>())
{
var companiesFound = companies.GetAll().Where(x => x.CompanyName.Contains(searchString));
dgvOutput.DataSource = companiesFound.ToList<Company>();
}
我使用的 Company 类如下所示:
public class Company
{
public long Id { get; set; }
public string CompanyName { get; set; }
public string CompanyAddress { get; set; }
public string CompanyCity { get; set; }
}
所有的功能都能够正常运行,但是速度并不理想。是否有人可以帮我提供一些方法,让它的运行速度更快?创建索引?使用不同类型的查询?最好不要使用LINQ?