var cache = new CacheHelper(); cache.Add("key1", "value1");
var cache = new CacheHelper(); var myObject = new MyObject(); cache.Add("key2", myObject);
using CacheHelper; // elsewhere in code... CacheHelper.Current.Add("key1", "value1");In this example, the CacheHelper library is imported using a using statement and the static Current property is used to access the current instance of the cache. An item with key "key1" and value "value1" is then added to the cache. The CacheHelper library can be found in the Microsoft.Extensions.Caching package.