Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

Trigger caching headers finalization on write #100

Merged
merged 1 commit into from
Feb 9, 2017
Merged

Conversation

JunTaoLuo
Copy link
Contributor

@JunTaoLuo JunTaoLuo commented Feb 1, 2017

#92

  • Add tests for Write and WriteAsync
  • Test with compression middleware

{
var cachedResponse = entry as CachedResponse;
if (cachedResponse != null)
{
var segmentStream = new SegmentWriteStream(StreamUtilities.BodySegmentSize);
await cachedResponse.Body.CopyToAsync(segmentStream);
// We are guaranteed to have a SegmentReadStream.CopyToAsync(SegmentWriteStream)
cachedResponse.Body.CopyToAsync(segmentStream).Wait();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CopyTo

@@ -219,10 +214,11 @@ public class ResponseCachingMiddleware
return false;
}

internal async Task FinalizeCacheHeadersAsync(ResponseCachingContext context)
private bool FinalizeCacheHeadersShouldStoreVaryByEntry(ResponseCachingContext context)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a bit silly, a doc comment would be sufficient to explain the return parameter.

@@ -327,19 +343,33 @@ public class ResponseCachingMiddleware
}
}

internal Task OnResponseStartingAsync(ResponseCachingContext context)
private bool OnResponseStartingShouldFinalizeHeaders(ResponseCachingContext context)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StartResponse

_options.MaximumBodySize,
StreamUtilities.BodySegmentSize,
() => OnResponseStarting(context),
async () => await OnResponseStartingAsync(context));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no async await needed?

@JunTaoLuo
Copy link
Contributor Author

🆙📅

@JunTaoLuo JunTaoLuo changed the title Trigger caching headers finalization on write (WIP) Trigger caching headers finalization on write Feb 8, 2017
@JunTaoLuo JunTaoLuo merged commit 7190412 into dev Feb 9, 2017
@JunTaoLuo JunTaoLuo deleted the johluo/on-write branch February 9, 2017 18:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants