Пример #1
0
 public CustomCache(int cacheMemoryLimitMegabytes, IPersistanceProvider <TValue> persistanceProvider)
 {
     _persistanceProvider = persistanceProvider;
     _cache = new MemoryCache("", new NameValueCollection {
         { "CacheMemoryLimitMegabytes", cacheMemoryLimitMegabytes.ToString("D") }
     });
 }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();

            _toolkit      = new Toolkit(new LambdaLogger(LogToListBox));
            _sessionSaver = new IsolatedStorageProvider <MainFormSettings>();
        }
        public MainForm()
        {
            InitializeComponent();

            _toolkit = new Toolkit(new LambdaLogger(LogToListBox));
            _sessionSaver = new IsolatedStorageProvider<MainFormSettings>();
        }
 /// <summary>
 /// A custom cache that writes items out to a IPersistanceProvider when the item is evicted from the cache.
 /// </summary>
 /// <param name="slidingExpirationWindow">The amount of time before the item is automatically evicted if it has not been accessed.</param>
 /// <param name="cacheMemoryLimitMegabytes">The maximum size the cache can be before it starts force evicting items.</param>
 /// <param name="persistanceProvider">The service that will save and load data to a persistent storage.</param>
 public CustomCache(TimeSpan slidingExpirationWindow, int cacheMemoryLimitMegabytes, IPersistanceProvider <TValue> persistanceProvider)
 {
     _slidingExpirationWindow = slidingExpirationWindow;
     _persistanceProvider     = persistanceProvider;
     _cache = new MemoryCache("", new NameValueCollection {
         { "CacheMemoryLimitMegabytes", cacheMemoryLimitMegabytes.ToString("D") }
     });
 }