Compression is supported by the File Cache Provider, the Sqlite Cache Provider, and the SQL Server Cache Provider. To use it simply set the IsCompressed property equal to true on the provider. By default compression is off. Internally the GZip compression in the .NET framework is used to compress the data.
Example
//Create a file cache with compression on
string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "KellermanSoftware", "NetCachingLibrary", "Tests");
FileCacheProvider fileCacheProvider = new FileCacheProvider(directory);
fileCacheProvider.IsCompressed = true;
SmartConfig config = new SmartConfig(new MemoryCacheProvider(), fileCacheProvider);
//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 compressed
cache.Set<List<ReportDetail>>(cacheKey, report);