Questions tagged [asp.net-caching]

40 questions
26
votes
6 answers

how to cache css, images and js?

I would like to have images, css, and javascript cached client-side on their browser when they load up a web page. There are so many different types of caching I am confused as to which ones to use with asp.net mvc. Would it also be possible to…
chobo
  • 31,561
  • 38
  • 123
  • 191
16
votes
6 answers

OutputCache / ResponseCache VaryByParam

ResponseCache is somewhat a replacement for OutputCache; however, I would like to do server side caching as well as per parameter input. According to some answers here and here, I should be using IMemoryCache or IDistributedCache to do this. I'm…
Nick De Beer
  • 5,232
  • 6
  • 35
  • 50
7
votes
3 answers

OutputCache varying by a complex object property

I have a controller action that receives a complex object as a parameter, I need the OutputCache to vary by one of the properties of this complex object. Is this possible? How?
juliano.net
  • 7,982
  • 13
  • 70
  • 164
6
votes
1 answer

Authorization and ASP.NET MVC Caching

I'm confused on ASP.NET MVC caching and authorization and in dire need of some clarification. My self-made authorization attribute inherits from AuthorizeAttribute. Its overridden AuthorizeCore method runs every time, even if I set an [OutputCache]…
Alex
  • 75,813
  • 86
  • 255
  • 348
5
votes
1 answer

Intermittent Linq FirstOrDefault Error - Index was outside the bounds of the array

About once a month, we've been running into a bizarre error that I have no explanation for. The error is this: System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.List`1.Enumerator.MoveNext()…
maembe
  • 1,270
  • 1
  • 13
  • 25
4
votes
1 answer

DonutOutputCache is not clearing cache when using variable

I have an ActionResult which i want it to be cached based on the id [DonutOutputCache(Duration = 3600, VaryByParam = "product_Id")] public ActionResult ProductInfo(Guid product_Id) { System.Threading.Thread.Sleep(3000); return…
Catalin
  • 11,503
  • 19
  • 74
  • 147
4
votes
1 answer

What caching algorithm does ASP.Net use?

I'm writing a wrapper around ASP.Net's cache and I'm curious as to what caching algorithm they use. For instance, assuming everything in the cache has the same expiration date and priority, how does it clear out items? Wikipedia lists 11 different…
Earlz
  • 62,085
  • 98
  • 303
  • 499
3
votes
1 answer

Caching in ASP.NET 5 in Controller

I am trying to cache a output controller like I did in ASP.NET MVC 5. I did that in ASP.NET MVC 5 Controller: [OutputCache(Duration = 60, VaryByParam = "*", Location = OutputCacheLocation.ServerAndClient)] Now, I'm trying that in ASP.NET 5 MVC…
chemitaxis
  • 13,889
  • 17
  • 74
  • 125
3
votes
1 answer

Caching dynamic pages in .net

I have some dynamic asp.net pages. They have datalist controls. I want to cache my pages but also I want to see the changes of data during the duration time of cache. I don't know how can I do that. Do you have any suggestion?
cagin
  • 5,772
  • 14
  • 74
  • 130
2
votes
2 answers

Is there a way to use use a cache profile when manually adding items to the cache?

I have output caching in my application configured using output cache profiles in the web.config. It is very convenient to be able to setup caching on all the output items that need it and then be able to adjust all the cache settings in one…
Zack
  • 2,291
  • 2
  • 23
  • 38
2
votes
1 answer

OutputCache varying by a complex object property passed using ModelBinder from Session

We are using Couchbase for our Session and for OutputCache. In this context, how can we cache by a complex object that is being passed to the method using a Custom Model Binder that retrieves a value from the Session? This is the signature of the…
Dzyann
  • 5,062
  • 11
  • 63
  • 95
2
votes
4 answers

asp.net - deleting cache object at session end

I have a wrapper class for Caching (CachingBL) where I store users that are currently signed in (some of their session info). In CachingBL wrapper there is actually a dictionary of users, and I am putting that dictionary in cache like this:…
the berserker
  • 1,553
  • 3
  • 22
  • 39
2
votes
1 answer

Caching expensive SQL query in memory or in the database?

Let me start by describing the scenario. I have an MVC 3 application with SQL Server 2008. In one of the pages we display a list of Products that is returned from the database and is UNIQUE per logged in user. The SQL query (actually a VIEW) used to…
2
votes
1 answer

How is HttpContext.Current.Cache saving objects in memory?

I am using HttpContext.Current.Cache to save objects into memory. The code i have looks something like this: public void Add(string key, object data, TimeSpan slidingExpirationTime) { HttpContext.Current.Cache.Insert(key, data, null,…
Catalin
  • 11,503
  • 19
  • 74
  • 147
1
vote
1 answer

asp.net webservice cache extend expiration

I haven't found anything so I dont believe what I want is possible. I want to reset the sliding expiration of a cache variable every time it is accessed. public class MyCache { public static object CachedItem { get { string key =…
Tom Fobear
  • 6,729
  • 7
  • 42
  • 74
1
2 3