public FileModel(FileAndType ft, object content, FileAndType original = null, IFormatter serializer = null) { OriginalFileAndType = original ?? ft; if (OriginalFileAndType.File.StartsWith("~/")) { Key = OriginalFileAndType.File; } else { Key = "~/" + OriginalFileAndType.File; } FileAndType = ft; ModelWithCache = new ModelWithCache(content, serializer); }
public FileModel(FileAndType ft, object content, FileAndType original, IFormatter serializer, string key) { OriginalFileAndType = original ?? ft; Key = key; if (Key == null) { if (OriginalFileAndType.File.StartsWith("~/", StringComparison.Ordinal)) { Key = OriginalFileAndType.File; } else { Key = "~/" + OriginalFileAndType.File; } } FileAndType = ft; ModelWithCache = new ModelWithCache(content, serializer); }
public void Dispose() { ModelWithCache.Dispose(); }
private static void OnLruRemoving(ModelWithCache m) { try { m.Serialize(); } catch (Exception ex) { Logger.LogWarning($"Unable to serialize model, details:{ex.ToString()}", file: m.File); } }