public void Persist(CacheableEntity value) { string targetFile = Path.Combine(_targetFolder, value.GetUniqueHash() + CacheFileExtension); XmlSerializer serializer = new XmlSerializer(value.GetType()); using (TextWriter writer = new StreamWriter(targetFile)) { serializer.Serialize(writer, value); } }
public void Set(CacheableEntity cacheItem, SyncMode syncMode = SyncMode.NoSync) { var item = new CacheItem(cacheItem.GetUniqueHash(), cacheItem); if (IsSlaveCache && syncMode != SyncMode.NoSync) _masterCache.Set(cacheItem, GetSyncModeForParentCache(syncMode)); lock (_locker) _cacheInfraestructure.Set(item.Key, item, GetDefaultCacheItemPolicy()); ItemEstablished(cacheItem); }
private void ItemEstablished(CacheableEntity item) { if (_persistenceEngine != null) _persistenceEngine.Persist(item); }
public void Remove(CacheableEntity value) { string targetFile = Path.Combine(_targetFolder, value.GetUniqueHash() + CacheFileExtension); File.Delete(targetFile); }
public void Set(CacheableEntity item, SyncMode syncMode = SyncMode.NoSync) { _masterCache.Set(item, syncMode); }
public void Remove(CacheableEntity value) { throw new NotImplementedException(); }
public void Persist(CacheableEntity value) { throw new NotImplementedException(); }