/// <summary> /// Initializes a new instance of the DiskCache class. /// </summary> /// <param name="localPath">The path of the directory to store cached content in.</param> /// <param name="maxSize">The maximum size, in bytes, to allow the cache to grow to.</param> public DiskCache(string localPath, long maxSize) { if (string.IsNullOrEmpty(localPath)) { throw new ArgumentNullException("path", "path must contain a value."); } this.localPath = localPath; this.databasePath = System.IO.Path.Combine(localPath, "Parlay.sqlite"); this.connectionString = string.Format(CultureInfo.InvariantCulture, "Data Source={0};DateTimeKind=Utc;Journal Mode=Off;Synchronous=Off;Version=3", this.databasePath); this.cache = new SqliteCache(this, maxSize); if (!Directory.Exists(localPath)) { Directory.CreateDirectory(localPath); } }
/// <summary> /// Initializes a new instance of the MemoryCache class. /// </summary> /// <param name="maxSize">The maximum size, in bytes, to allow the cache to grow to.</param> public MemoryCache(long maxSize) { this.cache = new SqliteCache(this, maxSize); }
private void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { if (this.cache != null) { this.cache.Dispose(); } } this.cache = null; this.disposed = true; } }