示例#1
0
        public ActionResult AddKey(string key, string val, string addType, int ticks)
        {
            DoRedisStringCache _cache = new DoRedisStringCache();


            RedisConfig config = new RedisConfig();

            _cache.StringSet(config.Connection, config.PrefixKey);



            if (addType.Equals("1"))
            {
                _cache.StringSet(key, val, new TimeSpan(1, 0, 0));

                _cacheHelper.Insert("Autowired_" + key, val, 5);
            }
            else
            {
                var list = GetGroupList();
                // _cache.StringSetAsync<List<GroupEntity>>(key, list);
                _cache.StringSet(key, list, new TimeSpan(1, 0, 0));
            }


            return(RedirectToAction("Index"));
        }
示例#2
0
        public JsonResult GetKey(string key)
        {
            DoRedisStringCache _cache = new DoRedisStringCache();

            var result = _cache.StringGet <List <GroupEntity> >(key);

            return(Json(result));
        }
示例#3
0
        public ActionResult SyncAddKey(string key, string val, string addType, int ticks)
        {
            DoRedisStringCache _cache = new DoRedisStringCache();

            _cache.StringSetAsync(key, val);

            _cacheHelper.InsertAsync("自动注入_" + key, val);


            return(RedirectToAction("Index"));
        }