locked
How to get all keys/data from redis cache RRS feed

  • Question

  • User-1593844237 posted
    I wanna read all keys from redis cache or if possible wanna read all keys and data at the same time.

    If anybody have any idea about the topic, kindly share it.
    Thanks
    Saturday, June 23, 2018 7:59 AM

Answers

  • User-1593844237 posted

    ConfigurationOptions options = ConfigurationOptions.Parse(RedisCacheConnectionstring);
    ConnectionMultiplexer connection = ConnectionMultiplexer.Connect(options);
    IDatabase db = connection.GetDatabase();
    EndPoint endPoint = connection.GetEndPoints().First();
    RedisKey[] keys = connection.GetServer(endPoint).Keys(pattern: "*").ToArray();
    var server = connection.GetServer(endPoint);
    foreach (var key in server.Keys())
    {
    // Use Keys as per requirement
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 24, 2018 10:28 AM