Ejemplo n.º 1
0
        protected BaseStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheMaxLifetimeInMillis = DefaultCacheMaxLifetimeInMillis)
        {
            if (isf == null)
            {
                throw new ArgumentNullException("isf");
            }

            if (String.IsNullOrEmpty(cacheDirectory))
            {
                throw new ArgumentException("cacheDirectory name could not be null or empty");
            }

            if (!cacheDirectory.StartsWith("\\"))
            {
                throw new ArgumentException("cacheDirectory name should starts with double slashes: \\");
            }

            if (cacheFileNameGenerator == null)
            {
                throw new ArgumentNullException("cacheFileNameGenerator");
            }

            ISF                      = isf;
            CacheDirectory           = cacheDirectory;
            CacheFileNameGenerator   = cacheFileNameGenerator;
            CacheMaxLifetimeInMillis = cacheMaxLifetimeInMillis;

            // Creating cache directory if it not exists
            ISF.CreateDirectory(CacheDirectory);
        }
        protected BaseStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheMaxLifetimeInMillis = DefaultCacheMaxLifetimeInMillis)
        {
            if (isf == null)
            {
                throw new ArgumentNullException("isf");
            }

            if (String.IsNullOrEmpty(cacheDirectory))
            {
                throw new ArgumentException("cacheDirectory name could not be null or empty");
            }

            if (!cacheDirectory.StartsWith("\\"))
            {
                throw new ArgumentException("cacheDirectory name should starts with double slashes: \\");
            }

            if (cacheFileNameGenerator == null)
            {
                throw new ArgumentNullException("cacheFileNameGenerator");
            }

            ISF = isf;
            CacheDirectory = cacheDirectory;
            CacheFileNameGenerator = cacheFileNameGenerator;
            CacheMaxLifetimeInMillis = cacheMaxLifetimeInMillis;

            // Creating cache directory if it not exists
            ISF.CreateDirectory(CacheDirectory);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates instance
 /// </summary>
 /// <param name="isf">IsolatedStorageFile instance to work with file system</param>
 /// <param name="cacheDirectory">Directory to store cache, starting with two slashes "\\"</param>
 /// <param name="cacheFileNameGenerator">ICacheFileNameGenerator instance to generate cache filenames</param>
 /// <param name="cacheMaxLifetimeInMillis">Cache max lifetime in millis, for example two weeks = 2 * 7 * 24 * 60 * 60 * 1000; default value == 0; pass value &lt;= 0 to disable max cache lifetime</param>
 public UnlimitedStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheMaxLifetimeInMillis = 0)
     : base(isf, cacheDirectory, cacheFileNameGenerator, cacheMaxLifetimeInMillis)
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates new LimitedStorageCache instance
 /// </summary>
 /// <param name="isf">IsolatedStorageFile instance to work with file system</param>
 /// <param name="cacheDirectory">Directory to store cache, starting with two slashes "\\"</param>
 /// <param name="cacheFileNameGenerator">ICacheFileNameGenerator instance to generate cache filenames</param>
 /// <param name="cacheLimitInBytes">Limit of total cache size in bytes, for example 10 mb == 10 * 1024 * 1024</param>
 /// <param name="cacheMaxLifetimeInMillis">Cache max lifetime in millis, for example two weeks = 2 * 7 * 24 * 60 * 60 * 1000; default value == one week; pass value &lt;= 0 to disable max cache lifetime</param>
 public LimitedStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheLimitInBytes, long cacheMaxLifetimeInMillis = DefaultCacheMaxLifetimeInMillis)
     : base(isf, cacheDirectory, cacheFileNameGenerator, cacheMaxLifetimeInMillis)
 {
     _cacheLimitInBytes = cacheLimitInBytes;
     BeginCountCurrentCacheSize();
 }
 /// <summary>
 /// Creates new LimitedStorageCache instance
 /// </summary>
 /// <param name="isf">IsolatedStorageFile instance to work with file system</param>
 /// <param name="cacheDirectory">Directory to store cache, starting with two slashes "\\"</param>
 /// <param name="cacheFileNameGenerator">ICacheFileNameGenerator instance to generate cache filenames</param>
 /// <param name="cacheLimitInBytes">Limit of total cache size in bytes, for example 10 mb == 10 * 1024 * 1024</param>
 /// <param name="cacheMaxLifetimeInMillis">Cache max lifetime in millis, for example two weeks = 2 * 7 * 24 * 60 * 60 * 1000; default value == one week; pass value &lt;= 0 to disable max cache lifetime</param>
 public LimitedStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheLimitInBytes, long cacheMaxLifetimeInMillis = DefaultCacheMaxLifetimeInMillis)
     : base(isf, cacheDirectory, cacheFileNameGenerator, cacheMaxLifetimeInMillis)
 {
     _cacheLimitInBytes = cacheLimitInBytes;
     BeginCountCurrentCacheSize();
 }
 /// <summary>
 /// Creates instance 
 /// </summary>
 /// <param name="isf">IsolatedStorageFile instance to work with file system</param>
 /// <param name="cacheDirectory">Directory to store cache, starting with two slashes "\\"</param>
 /// <param name="cacheFileNameGenerator">ICacheFileNameGenerator instance to generate cache filenames</param>
 /// <param name="cacheMaxLifetimeInMillis">Cache max lifetime in millis, for example two weeks = 2 * 7 * 24 * 60 * 60 * 1000; default value == 0; pass value &lt;= 0 to disable max cache lifetime</param>
 public UnlimitedStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheMaxLifetimeInMillis = 0)
     : base(isf, cacheDirectory, cacheFileNameGenerator, cacheMaxLifetimeInMillis)
 {
 }