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")); }
public JsonResult GetKey(string key) { DoRedisStringCache _cache = new DoRedisStringCache(); var result = _cache.StringGet <List <GroupEntity> >(key); return(Json(result)); }
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")); }