//Create a Primary Memory Cache with a backing File Cache
string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "KellermanSoftware", "NetCachingLibrary", "Tests");
SmartConfig config = new SmartConfig(new MemoryCacheProvider(), new FileCacheProvider(directory));
//Specify UserName and LicenseKey for Licensed Mode
//config.UserName = "my user name";
//config.LicenseKey = "my license key";
//Instantiate the cache
SmartCache cache = new SmartCache(config);
//Build parameters for the report
int month = DateTime.Now.Month;
int year = DateTime.Now.Year;
//Get the cache key based on the report parameters
string cacheKey = cache.BuildCacheKey("MonthlySalesReport", month, year);
//Get a long running report
List<ReportDetail> report = ReportLogic.MonthlySalesReport(month, year);
//Save to the cache
cache.Set<List<ReportDetail>>(cacheKey, report);
//Get all the keys in the memory cache in the Default region
IEnumerable<string> keys = cache.GetPrimaryCacheKeys("Default");
foreach (var key in keys)
{
Console.WriteLine(key);
}