Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to cache specified HTTP headers. #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mlucas99
Copy link

Great library, saves a ton of work. Don't know if this is something you're interested in adding but it was a necessity for one of our latest projects.

When a response was cached, it didn't send any of the custom headers we were using to hold the total row count, and the Link header we were using to send pagination links. So I added an OutputCacheAttribute parameter that will preserve headers you specify.

Ex.
[CacheOutput(ClientTimeSpan = 60, ServerTimeSpan = 60, HeadersToInclude = "X-Total,Link")]

@filipw
Copy link
Owner

filipw commented Apr 16, 2015

thanks, this is a good idea, let me wrap my head around this

@mlucas99
Copy link
Author

A bug just cropped up in that code that could cause a 500, so you don't want this code as is. I had duplicated the line AddCachedHeaders call on line 164.

@mleonelli
Copy link

Any update on this functionalty? It seems promising

@Symbianx
Copy link
Contributor

Is this something that will be added? This PR is the only thing stopping us from using this LIB.

@mleonelli
Copy link

mleonelli commented Mar 27, 2018

I ended up forking the project and using @mlucas99 changes... The only additional change is that on line 100 ShortTime requires an additional 3rd paramenter.

CacheTimeQuery = new ShortTime(ServerTimeSpan, ClientTimeSpan, null);

Thanks!

@mribichich
Copy link

Hi, Any update on this? I would love to cache custom headers too for some requets
thanks

@mribichich
Copy link

Sorry to bother, is this still a possibility? Do you need any help? thanks!

@mribichich
Copy link

@mlucas99 could you update the PR to the latest version of CacheOutputAttribute.cs
Or I could copy the new changes and make a new PR
let me know

I've been using this and it works great

thanks!

@mribichich
Copy link

@filipw Could you merge this? Because I think that mlucas is not using it anymore

let me know if you want me to do it

thanks!

@an-d-uu
Copy link

an-d-uu commented Dec 30, 2021

I couldn't get this to work with this version, so I updated the code and made the modifications needed to allow for custom headers to be cached.

Pull Request: #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants