'Declaration Public Sub ClearAll()
'Usage Dim instance As SmartCache instance.ClearAll()
public void ClearAll()
public: void ClearAll();
public: void ClearAll();
'Declaration Public Sub ClearAll()
'Usage Dim instance As SmartCache instance.ClearAll()
public void ClearAll()
public: void ClearAll();
public: void ClearAll();
//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 cache.Set(cacheKey, report); //Clear both the primary and secondary caches cache.ClearAll(); //Primary Count Will Be Zero Console.WriteLine(cache.GetTotalPrimaryCount()); //Secondary Count Will Be Zero Console.WriteLine(cache.GetSecondaryTotalCount());
'Create a Primary Memory Cache with a backing File Cache Dim directory As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "KellermanSoftware", "NetCachingLibrary", "Tests") Dim config As 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 Dim cache As New SmartCache(config) 'Build parameters for the report Dim month As Integer = Date.Now.Month Dim year As Integer = Date.Now.Year 'Load the report from the database Dim report As List(Of ReportDetail) = ReportLogic.MonthlySalesReport(month, year) 'Get the cache key based on the report parameters Dim cacheKey As String = cache.BuildCacheKey("MonthlySalesReport", month, year) 'Save the report to the cache cache.Set(cacheKey, report) 'Clear both the primary and secondary caches cache.ClearAll() 'Primary Count Will Be Zero Console.WriteLine(cache.GetTotalPrimaryCount()) 'Secondary Count Will Be Zero Console.WriteLine(cache.GetSecondaryTotalCount())
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2