//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);
cache.Set<string>("LovelySpam", "WonderfulSpam");
cache.Set<string>("ChoppinBrocolli", "SheWasChoppinBrocolli");
cache.Set<string>("ChoppinBrocolliAtHome", "SheWasChoppinBrocolli");
//Clear any keys beginning with Choppin
cache.ClearByRegex(new Regex("^Choppin.*$"));
//These will both be false since both cache items were deleted
Console.WriteLine(cache.Contains("ChoppinBrocolli"));
Console.WriteLine(cache.Contains("ChoppinBrocolliAtHome"));
//This will be true since the key did not match the regex and the cache item still exists
Console.WriteLine(cache.Contains("LovelySpam"));