public async Task <IActionResult> Usage() { // 1. insert a new caching item. var obj = new Product() { Id = 100, Name = "Product100" }; var cacheEntry = new CacheEntry("mykey", obj, TimeSpan.FromSeconds(3600)); await _caching.SetAsync(cacheEntry); // 2. get a caching item by specify key. dynamic product = await _caching.GetAsync("mykey"); var id = product.Id; var name = product.Name; // 3. remove caching item. // 3.1 remove caching item by specify key. await _caching.RemoveAsync("mykey"); // 3.2 remove all expirate caching item. await _caching.FlushAllExpirationAsync(); return(Content("ok")); }