protected CachedHandlerResource(IHandlerResource inner, Action <IHandlerResource, MemoryStream> writeContent) { _lastModified = inner.GetLastModified(); _resourceType = inner.ResourceType; _content = new MemoryStream(); writeContent(inner, _content); }
private static void CompressContent(IHandlerResource inner, MemoryStream outputStream) { var compressingStream = outputStream.Compress(leaveOpen: true); inner.WriteContent(compressingStream); //for some stupid reason, Flush() doesn't work here, so you have to call Close or your content //can end up truncated compressingStream.Close(); }
private IHandlerResource GetResourceInternal(ref IHandlerResource cachedResource, Func <IHandlerResource, IHandlerResource> createCachedResource) { if (cachedResource != null) { return(cachedResource); } var resource = GetResource(); if (CachingEnabled) { resource = createCachedResource(resource); cachedResource = resource; } return(resource); }
protected CachedHandlerResource(IHandlerResource inner, Action<IHandlerResource,MemoryStream> writeContent) { _lastModified = inner.GetLastModified(); _resourceType = inner.ResourceType; _content = new MemoryStream(); writeContent(inner, _content); }
public CachedHandlerResource(IHandlerResource inner) : this(inner, (r,s) => r.WriteContent(s)) { }
private static void CompressContent(IHandlerResource inner, MemoryStream outputStream) { var compressingStream = outputStream.Compress(leaveOpen : true); inner.WriteContent(compressingStream); //for some stupid reason, Flush() doesn't work here, so you have to call Close or your content //can end up truncated compressingStream.Close(); }
public CachedGZippedHandlerResource(IHandlerResource inner) : base(inner, CompressContent) { }
private IHandlerResource GetResourceInternal(ref IHandlerResource cachedResource, Func<IHandlerResource,IHandlerResource> createCachedResource) { if (cachedResource != null) { return cachedResource; } var resource = GetResource(); if (CachingEnabled) { resource = createCachedResource(resource); cachedResource = resource; } return resource; }
public CachedHandlerResource(IHandlerResource inner) : this(inner, (r, s) => r.WriteContent(s)) { }
public CachedGZippedHandlerResource(IHandlerResource inner) : base(inner, CompressContent) { }