From 1019e6ca92b96f23eb3f5f019d7fab755e433c25 Mon Sep 17 00:00:00 2001 From: ndrwrbgs Date: Fri, 27 Dec 2019 18:26:57 -0800 Subject: [PATCH] Add a ctor with all arguments --- src/FileCache/FileCache.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/FileCache/FileCache.cs b/src/FileCache/FileCache.cs index 9d3de91..64f59f7 100644 --- a/src/FileCache/FileCache.cs +++ b/src/FileCache/FileCache.cs @@ -275,6 +275,31 @@ public FileCache( Init(DefaultCacheManager, calculateCacheSize, cleanInterval, false, false); } + /// + /// Creates an instance of the file cache. + /// + /// + /// The cache's root file path + /// The SerializationBinder used to deserialize cached objects. Needed if you plan + /// to cache custom objects. + /// If true, will calcualte the cache's current size upon new object creation. + /// Turned off by default as directory traversal is somewhat expensive and may not always be necessary based on + /// use case. + /// + /// If supplied, sets the interval of time that must occur between self cleans + public FileCache( + FileCacheManagers manager, + string cacheRoot, + SerializationBinder binder, + bool calculateCacheSize = false, + TimeSpan cleanInterval = new TimeSpan() + ) + { + _binder = binder; + CacheDir = cacheRoot; + Init(manager, calculateCacheSize, cleanInterval, false, false); + } + #endregion #region custom methods