An interface that knows how to read/write subclasses of ICacheItem. Obviously there will be a tight coupling between concrete implementations of ICacheItem and concrete implementations of ICacheItemPersister.
		public PersistentCache(string filename, CacheItemPersister persister, long maxSize)
		{
			this.maxSize = maxSize;
			this.persister = persister;
			this.dataFile = new FileInfo(filename);
			this.lockFile = new LockFile(filename + ".lock");
		}
 public PersistentCache(string filename, CacheItemPersister persister, long maxSize)
 {
     this.maxSize   = maxSize;
     this.persister = persister;
     this.dataFile  = new FileInfo(filename);
     this.lockFile  = new LockFile(filename + ".lock");
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersistentCache"/> for the given filename and cache type.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="persister"></param>
 public PersistentCache(string filename, CacheItemPersister persister)
 {
     this.persister = persister;
     //Windows.Storage.Streams.StreamReference sr = Windows.Storage.Streams.StreamReference.CreateFromUri(new Uri(filename));
     //this.dataFile = new FileInformation(filename);
     this.lockFile = new LockFile(filename + ".lock");
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersistentCache"/> for the given filename and cache type.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="persister"></param>
 public PersistentCache(string filename, CacheItemPersister persister)
 {
     this.persister = persister;
     //Windows.Storage.Streams.StreamReference sr = Windows.Storage.Streams.StreamReference.CreateFromUri(new Uri(filename));
     //this.dataFile = new FileInformation(filename);
     this.lockFile = new LockFile(filename + ".lock");
 }
Esempio n. 5
0
        private DateTime timestamp; // last-modified time of dataFile when cache data was last known to be in sync

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="PersistentCache"/> for the given filename and cache type.
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="persister"></param>
        public PersistentCache(string filename, CacheItemPersister persister)
        {
            this.persister = persister;
            dataFile = new FileInfo(filename);
            lockFile = new LockFile(filename + ".lock");
        }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersistentCache"/> for the given filename and cache type.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="persister"></param>
 public PersistentCache(string filename, CacheItemPersister persister)
 {
     this.persister = persister;
     dataFile       = new FileInfo(filename);
     lockFile       = new LockFile(filename + ".lock");
 }