private static void RunListKeys(ListKeys options)
        {
            Console.WriteLine($"List Redis Keys...");
            Console.WriteLine(@"");

            var configuration = Configuration.GetConfiguration();

            var redis    = ConnectionMultiplexer.Connect(configuration["RedisConnectionString"]);
            var server   = redis.GetServer(configuration["RedisInstance"]);
            var database = redis.GetDatabase();

            var pattern = string.IsNullOrEmpty(options.Pattern) ? "*" : options.Pattern;

            var keys = server.Keys(database: database.Database, pattern: pattern);

            if (keys == null)
            {
                Console.WriteLine("No keys found.");
            }
            else
            {
                foreach (var key in keys)
                {
                    Console.WriteLine($"{key}");
                }
            }
        }
Пример #2
0
        public IEnumerable All()
        {
            var c = new ListKeys(new ListKeysOptions(Name));

            Database.Execute(c);

            foreach (var key in c.Response.Value)
            {
                var get = new Get.Builder()
                          .WithTable(Name)
                          .WithKey(key)
                          .Build();

                Database.Execute(get);

                yield return(Extract(get.Response.Value.First()));
            }
        }