//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;
//Load the report from the database
List<ReportDetail> report = ReportLogic.MonthlySalesReport(month, year);
//Get the cache key based on the report parameters
string cacheKey = cache.BuildCacheKey("MonthlySalesReport", month, year);
//Save the report to the cache to the Default Region
cache.Set(cacheKey, report, "Default");
//Save the report to the cache to the Other Region
cache.Set(cacheKey, report, "Other");
//Clear the default region
cache.ClearRegion("Default");
//Primary Count Will Be Zero for Default region
Console.WriteLine(cache.GetPrimaryCount("Default"));
//Primary Count Will Be One or more for the
Console.WriteLine(cache.GetPrimaryCount("Other"));