Adding and retrieving Data sets to Redis using StackExchange.Redis

13,963

To set multiple values in a hash you can call the following HashSet method overload:

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();
db.HashSet("user:user1", new HashEntry[] { new HashEntry("12", "13"), new HashEntry("14", "15") });
Share:
13,963
Praveen Mohan
Author by

Praveen Mohan

Updated on June 05, 2022

Comments

  • Praveen Mohan
    Praveen Mohan almost 2 years

    Am new to Redis. I am able to store and retrieve data to redis using this commands

    hmset user:user1 12 13 14 15 
    

    and also am to retrieve data by

    hgetall user:user1
    

    i want to do the same using stackExchange.redis on my c# program. how should i do this in c#?