Reputation: 358
I am using Redis cache from StackExchange.Redis.
How can i retrieve set of values if a key contains the specified string.
For example,
I want to get list of users by passing a key value.
something like sending user
as key like that.
Currently my code to set key value is below,
// _redis is IRedisCacheClient from StackExchange.Redis.Extensions.Core.Abstractions
_redis.Db0.Add("user:1", user);
Any suggestions/help is welcome.
Upvotes: 2
Views: 1585
Reputation: 358
After a bit of research for a while sharing knowledge here. The list of users can be retrieved by passing key like this "user:*"
Example,
Key:
"user:1"
with Value: "User1 object"Key:
"user:2"
with Value: "User2 object"
The key to get list of users will be "user:*"
Upvotes: 3