示例#1
0
        public JsonResult GetObjList(string key)
        {
            RedisListCache cache     = new RedisListCache();
            RedisHashCache hashCache = new RedisHashCache(0);

            //List<GroupEntity> list = cache.ListRange<GroupEntity>(key);

            GroupEntity m = cache.ListLeftPop <GroupEntity>(key);

            GroupEntity m1 = hashCache.HashGet <GroupEntity>(key + "Hash", "50");

            List <GroupEntity> list = new List <GroupEntity>();

            list.Add(m);
            list.Add(m1);

            return(Json(list));
        }
示例#2
0
        public ActionResult SyncAddKeyObj(string key)
        {
            List <GroupEntity> list = GetGroupList();
            //_cacheHelper.InsertAsync(key, list);

            RedisListCache cache     = new RedisListCache();
            RedisHashCache hashCache = new RedisHashCache(0);

            foreach (GroupEntity m in list)
            {
                cache.ListLeftPush(key, m);

                cache.ListRightPushAsync(key + "Async", m);

                hashCache.HashSet(key + "Hash", m.ID.ToString(), m);

                hashCache.HashSetAsync(key + "HashAsync", m.ID.ToString(), m);
            }
            return(RedirectToAction("Index"));
        }