StackExchange.Redis

Keys and Values

Setting Values

All values in Redis are ultimately stored as a RedisValue type:

//"myvalue" here is implicitly converted to a RedisValue type
//The RedisValue type is rarely seen in practice.
db.StringSet("key", "aValue");

Setting and getting an int

db.StringSet("key", 11021);
int i = (int)db.StringGet("key");

Or using StackExchange.Redis.Extensions:

db.Add("key", 11021);
int i = db.Get<int>("key");

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow