Performing a Search on StackExchange.Redis

I am using the Stack Exchange.Net Redis provider to store and retrieve values. I would like to know how I can find certain records inside Redis (for example, any database, search must be done on a Redis instance not in a .Net application)

Example:

public class Employee
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Age { get; set; }
    public int Salary {get;set;}
}

      

If I have 100,000 employee records stored as .Net " List<Employee> lstEmployee = new List<Employee>();

" in a Redis cache server and you only want to get a record that is age> 50 and salary> 5000, how do I encode it?

Disclosure: I'm just getting started with Redis using this example .

+3


source to share


1 answer


First, the "cache server" is not intended to be used as the requested storage. If we assume you are just referring to the nosql backend, then ... well, to be honest, this doesn't sound like the kind of query I would try to make through redis. The redis point is that you create whatever indexes you need yourself. If you want ordered range queries (age / salary), then a sorted set and ZRANGEBYSCORE are probably a viable option; however, the intersection of the two is more complex. You can try asking the same ib question in the redisdb google-group, but just like the general redis question - not specific to any client library like SE.Redis. If ib redis operations exist, you can use the client library to call them.



I am wondering, however, if "elastic" might be the best option for what you are describing.

+5


source







All Articles