0

I was searching for a local cache solution to store output cache in user browser so that each user has his own cache, and i arrived to use he following profile:

<add name="Cache30MinClient" duration="1800" varyByParam="none" location="Client" noStore="true" />

However i found the following post which state that user cache is done by varyByCustom attibute .

My question is: Is my solution enough for caching data in user browser or should i follow that post?

Thanks.

Community
  • 1
  • 1
Maro
  • 2,579
  • 9
  • 42
  • 79

1 Answers1

0

It depends :) GetVaryByCustomString essentially lets you to select piece from http request that can be used as cache key. In your solution (I'm kind of missing the controller piece) your cache key is empty - so every single user will get the same result - this may be fine if the users are anonymous or if the fact that user is authenticated or not doesn't play a role in output html.

Ondrej Svejdar
  • 21,349
  • 5
  • 54
  • 89
  • Thanks Onderej, in fact users shouldn't get the same, each user should have his own data stored locally. – Maro Jul 18 '16 at 11:35
  • @Maro - then you should follow the varyByCustom route and hook to some kind of used id - as in the reference you're noting. – Ondrej Svejdar Jul 18 '16 at 11:41