Caching
1. In-Memory Cache
using System; using System.Runtime.Caching; class Program { static void Main() { ObjectCache cache = MemoryCache.Default; string key = "myKey"; string value = "myValue"; // Add data to cache with a lifetime of 1 minute cache.Set(key, value, DateTimeOffset.Now.AddMinutes(1)); // Retrieve data from cache var cachedValue = cache.Get(key) as string; Console.WriteLine(cachedValue); // Output: myValue } }
2. Distributed Cache
3. Output Cache
Summary
Last updated