コード例 #1
0
        public ActionResult Article(string id, string title)
        {
            var cacheKey = string.Format(CacheKeyTemplate.PostByIdCacheKey, id);
            var post     = _redisCacheService.GetOrSet(key: cacheKey, factory: () => _postService.Get(id), cacheTimeInMinutes: 60);

            return(View(post));
        }
コード例 #2
0
        public ValueModel Get(int id)
        {
            var cacheKey = string.Format(ValuesCacheKeyTemplate.ValueByIdCacheKey, id);

            return(_redisCacheService.GetOrSet(key: cacheKey, factory: () => _values.FirstOrDefault(v => v.Id == id), cacheTimeInMinutes: 60));
        }
コード例 #3
0
        public PostOutput Get(string id)
        {
            var cacheKey = string.Format(CacheKeyTemplate.PostByIdCacheKey, id);

            return(_redisCacheService.GetOrSet(key: cacheKey, factory: () => _postService.Get(id), cacheTimeInMinutes: 60));
        }