Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var cacheKey = _cacheManager.PrepareKeyForDefaultCache(AdminDefaults.RoleByIDCacheKey, 1);

            cacheKey.CacheTime = TimeSpan.FromHours(1);

            var cacheRefreshKey = _cacheManager.PrepareKeyForDefaultCache(AdminDefaults.RefreshRoleByIDCacheKey, 1);

            cacheRefreshKey.CacheTime = TimeSpan.FromSeconds(10);

            DateTime LastUpdateDate() => lad;

            TTLExtendableCacheObject <DateTime> dt = _cacheManager.GetOrCreate(cacheKey, () => saat(1), cacheRefreshKey, LastUpdateDate);

            ConcurrentDictionary <int, string> tete = new ConcurrentDictionary <int, string>();

            tete.AddOrUpdate(1, "one", (int key, string value) =>
            {
                return(key.ToString());
            });

            ViewBag.dt = abc;

            return(View());
        }
Ejemplo n.º 2
0
        public IActionResult Index()
        {
            TTLExtendableCacheObject <DateTime> saat()
            {
                return(new TTLExtendableCacheObject <DateTime>(DateTime.Now, DateTime.Now));
            }

            var cacheKey = _cacheManager.PrepareKeyForDefaultCache(AdminDefaults.RoleByIDCacheKey, 1);

            cacheKey.CacheTime = TimeSpan.FromHours(1);

            var cacheRefreshKey = _cacheManager.PrepareKeyForDefaultCache(AdminDefaults.RefreshRoleByIDCacheKey, 1);

            cacheRefreshKey.CacheTime = TimeSpan.FromSeconds(10);

            DateTime LastUpdateDate() =>
            DateTime.Now;

            TTLExtendableCacheObject <DateTime> dt = _cacheManager.GetOrCreate(cacheKey,
                                                                               saat, cacheRefreshKey, LastUpdateDate);

            ViewBag.dt = dt.CacheObject;


            NoSQLKey CategoriesByLangCacheKey = new NoSQLKey("Redis.CategoriesByLang-{0}");

            return(View());
        }