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

How to use: HttpResponse.RemoveOutputCacheItem when using varyByCustom #61

Open
jovana opened this issue Mar 1, 2017 · 2 comments
Open

Comments

@jovana
Copy link

jovana commented Mar 1, 2017

LS,

I have implemented the Redis OutputCache using the Azure Redis service.

On top of the pages need to cache:
<%@ OutputCache VaryByParam="*" Duration="600" %>

After access a random page and I check the key in Redis database is has saved like:
/_a2/monitor.aspxHQNactionVtestFCDE

So running the below line of code, will remove this cache item (and it worked).
HttpResponse.RemoveOutputCacheItem("/monitor.aspx?action=test", "RedisOutputCache")

Now I have updated the same page adding the varyByCustom the the OutputCache directive:
<%@ OutputCache VaryByParam="*" varyByCustom="userhash" Duration="600" %>

Now accessing the page and checking the key in Redis database it is saved like:
/_a2/monitor.aspxHQNactionVtestFCNuserhashVcc6ef5b7173286704cef942d5577b88bd81f2cce71a0dcdc8676d3a815e68b59DE

You see the added userhash hash value, this is nice and worked as axpected.
But now here comes the problem: How do I clear this cache item.

This is not working:
HttpResponse.RemoveOutputCacheItem("/monitor.aspx?action=test", "RedisOutputCache")

Also tried:
HttpResponse.RemoveOutputCacheItem("/monitor.aspx?action=test&userhash=cc6ef5b7173286704cef942d5577b88bd81f2cce71a0dcdc8676d3a815e68b59", "RedisOutputCache")

And also tried:
HttpResponse.RemoveOutputCacheItem("/monitor.aspx?action=test {userhash:cc6ef5b7173286704cef942d5577b88bd81f2cce71a0dcdc8676d3a815e68b59}", "RedisOutputCache")

Is there an way to remove this cache item on using the varyByCustom option?

Any help is most welcome!

Joël

@SiddharthChatrolaMs
Copy link
Contributor

This is more of asp.net question. Output cache provider it self is very simple. it put/get/deletes key that asp.net request it to. Why asp.net is not sending remove request is the question?

@mapalan
Copy link
Member

mapalan commented May 15, 2020

@jovana is this still something you are having an issue with?

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

No branches or pull requests

3 participants