Ejemplo n.º 1
0
 public IList <T> GetAll <T>(string generate) where T : class
 {
     //var result = new List<T>();
     //var dummy = _cacheClient.SearchKeys(generate + "*");
     //foreach (var key in dummy)
     //{
     //	result.Add(_cacheClient.Get<T>(key));
     //}
     //return result;
     return(_cacheClient.GetAll <T>(generate, 100));           // TODO:
 }
        public void Get_All_Should_Return_All_Database_Keys()
        {
            var values = Builder <TestClass <string> >
                         .CreateListOfSize(5)
                         .All()
                         .Build();

            values.ForEach(x => Db.StringSet(x.Key, Serializer.Serialize(x.Value)));

            IDictionary <string, string> result = Sut.GetAll <string>(new[] { values[0].Key, values[1].Key, values[2].Key, "notexistingkey" });

            Assert.True(result.Count() == 4);
            Assert.Equal(result[values[0].Key], values[0].Value);
            Assert.Equal(result[values[1].Key], values[1].Value);
            Assert.Equal(result[values[2].Key], values[2].Value);
            Assert.Null(result["notexistingkey"]);
        }
 public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys)
 {
     return ExecuteWithRetry(() => cacheClient.GetAll<T>(keys));
 }