Questions tagged [caching]

A cache is a mechanism for temporarily storing (caching) data locally in order to reduce access time to data stored far away. For CPU/disk/web browsing please use relevant tags (cpu-cache, diskcache,...)

A cache is a mechanism that involves temporarily storing data in places that are faster to access than the original storage location. can be machine code instructions, images, documents, or web pages, for example. The purpose of a cache is to reduce access time, bandwidth usage, server load, and perceived lag.

Different applications where cache mechanisms are used include:

Useful Links

37958 questions
372
votes
8 answers

ETag vs Header Expires

I've looked around but haven't been able to figure out if I should use both an ETag and an Expires Header or one or the other. What I'm trying to do is make sure that my flash files (and other images and what not only get updated when there is a…
GeoffreyF67
  • 11,061
  • 11
  • 46
  • 56
358
votes
23 answers

Force browser to clear cache

Is there a way I can put some code on my page so when someone visits a site, it clears the browser cache, so they can view the changes? Languages used: ASP.NET, VB.NET, and of course HTML, CSS, and jQuery.
Adam
  • 9,189
  • 15
  • 46
  • 62
320
votes
8 answers

Java time-based map/cache with expiring keys

Do any of you know of a Java Map or similar standard data store that automatically purges entries after a given timeout? This means aging, where the old expired entries “age-out” automatically. I know of ways to implement the functionality myself…
Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
309
votes
25 answers

How to clear the cache of nginx?

I use nginx to as the front server, I have modified the CSS files, but nginx is still serving the old ones. I have tried to restart nginx, to no success and I have Googled, but not found a valid way to clear it. Some articles say we can just delete…
Freewind
  • 193,756
  • 157
  • 432
  • 708
285
votes
12 answers

Is Redis just a cache?

I have been reading some Redis docs and trying the tutorial at http://try.redis-db.com/. So far, I can't see any difference between Redis and caching technologies like Velocity or the Enterprise Library Caching Framework You're effectively just…
Matt Evans
  • 7,113
  • 7
  • 32
  • 64
273
votes
11 answers

How do you clear Apache Maven's cache?

Recently, Apache Maven seems to be having caching issues. Performing clean installs on our projects using Windows Vista or Windows 7 sometimes produce artifacts with the same data as a previous build even though the newer artifact's files should…
MetroidFan2002
  • 29,217
  • 16
  • 62
  • 80
261
votes
15 answers

How to Empty Caches and Clean All Targets Xcode 4 and later

Jonathan suggest here: Xcode Includes .xib files that have been deleted! that cleaning all targets and empty the caches will fix the problem with Xcode including deleted .xib files but I cannot find a way to empty the cache in Xcode 4. How to do…
Tieme
  • 62,602
  • 20
  • 102
  • 156
260
votes
14 answers

How to cache data in a MVC application

I have read lots of information about page caching and partial page caching in a MVC application. However, I would like to know how you would cache data. In my scenario I will be using LINQ to Entities (entity framework). On the first call to…
Coolcoder
  • 4,036
  • 6
  • 28
  • 35
255
votes
16 answers

Angular IE Caching issue for $http

All the ajax calls that are sent from the IE are cached by Angular and I get a 304 response for all the subsequent calls. Although the request is the same, the response is not going be the same in my case. I want to disable this cache. I tried…
Rahul
  • 44,892
  • 25
  • 73
  • 103
251
votes
20 answers

Is there a decorator to simply cache function return values?

Consider the following: @property def name(self): if not hasattr(self, '_name'): # expensive calculation self._name = 1 + 1 return self._name I'm new, but I think the caching could be factored out into a decorator. Only I…
Tobias
  • 3,882
  • 2
  • 22
  • 25
247
votes
14 answers

Stop jQuery .load response from being cached

I have the following code making a GET request on a URL: $('#searchButton').click(function() { $('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val()); }); But the returned result is not always reflected. For…
dragonmantank
  • 15,243
  • 20
  • 84
  • 92
229
votes
6 answers

Difference between no-cache and must-revalidate for Cache-Control?

From the RFC 2616 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1 no-cache If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful…
Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
227
votes
5 answers

How can I clear the SQL Server query cache?

I've got a simple query running against SQL Server 2005 SELECT * FROM Table WHERE Col = 'someval' The first time I execute the query can take > 15 secs. Subsequent executes are back in < 1 sec. How can I get SQL Server 2005 not to use any cached…
PaulB
  • 23,264
  • 14
  • 56
  • 75
226
votes
5 answers

What is the difference between HTTP status code 200 (cache) vs status code 304?

I'm using the Google "Page Speed" plug-in for Firefox to access my web site. Some of the components on my page is indicated as HTTP status: 200 200 (cache) 304 By Google's "Page Speed". What I'm confused about is the difference between 200 (cache)…
Hank
  • 2,301
  • 2
  • 14
  • 6
220
votes
5 answers

How do cache lines work?

I understand that the processor brings data into the cache via cache lines, which - for instance, on my Atom processor - brings in about 64 bytes at a time, whatever the size of the actual data being read. My question is: Imagine that you need to…
Norswap
  • 11,740
  • 12
  • 47
  • 60