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

ResponseCache updates to support varyby rules #14

Merged
merged 1 commit into from
Aug 5, 2016
Merged

Conversation

JunTaoLuo
Copy link
Contributor

Updating the design of ResponseCache/ResponseCacheEntries to support varyby rules. The design of how to configure these rules and what elements to vary by have not been finalized yet.

cc @Tratcher @davidfowl


public void Set(string key, IResponseCacheEntry entry)
{
_cache.Set(key, DefaultResponseCacheSerializer.Serialize(entry));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

null checks needed to be added everywhere

Copy link
Member

Choose a reason for hiding this comment

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

And hardening. None of these operations should throw.

context.Response.GetTypedHeaders().CacheControl = new CacheControlHeaderValue()
{
Public = true,
MaxAge = TimeSpan.FromSeconds(10)
};
context.Response.GetTypedHeaders().AppendList("Vary", new string[] { "Accept-Encoding", "Non-Existent" });
Copy link
Member

Choose a reason for hiding this comment

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

???
context.Response.Headers["Vary"] = new string[] { "Accept-Encoding", "Non-Existent" };

@JunTaoLuo JunTaoLuo changed the title ResponseCache updates to support varyby rules (WIP) ResponseCache updates to support varyby rules Aug 1, 2016
@JunTaoLuo
Copy link
Contributor Author

🆙📅

{
public int StatusCode { get; set; }

internal IHeaderDictionary Headers { get; set; } = new HeaderDictionary();
Copy link
Member

Choose a reason for hiding this comment

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

Why are these internal and status code public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason, could make everything internal until there's a reason to make them public. I don't see why these would be used by anyone else other than response caching middleware.

using System;
using Microsoft.Extensions.Caching.Distributed;

namespace Microsoft.AspNetCore.ResponseCaching
Copy link
Member

Choose a reason for hiding this comment

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

Internal?

Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Aug 3, 2016

Choose a reason for hiding this comment

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

I'll move all the storage related types (other than the interface IResponseCache) to the internal namespace and make them internal types since they shouldn't be needed outside of response caching.

@Tratcher
Copy link
Member

Tratcher commented Aug 4, 2016

:shipit: after one comment

@JunTaoLuo JunTaoLuo merged commit a40cc88 into dev Aug 5, 2016
@JunTaoLuo JunTaoLuo deleted the johluo/varyby branch August 5, 2016 01:33
@JunTaoLuo JunTaoLuo mentioned this pull request Aug 23, 2016
34 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants