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,...)
38,352
questions
2834
votes
21
answers
924k
views
Ignore files that have already been committed to a Git repository [duplicate]
I have an already initialized Git repository that I added a .gitignore file to. How can I refresh the file index so the files I want ignored get ignored?
2799
votes
7
answers
113k
views
Flash CS4 refuses to let go
I have a Flash project, and it has many source files. I have a fairly heavily-used class, call it Jenine. I recently (and, perhaps, callously) relocated Jenine from one namespace to another. I thought ...
1894
votes
30
answers
1.3m
views
How do we control web page caching, across all browsers?
Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner.
For security reasons we do not want certain pages in our application to be cached, ever, ...
1731
votes
35
answers
856k
views
Disabling Chrome cache for website development
I am modifying a site's appearance (CSS modifications) but can't see the result on Chrome because of annoying persistent cache. I tried Shift+refresh but it doesn't work.
How can I disable the cache ...
1482
votes
17
answers
629k
views
Memcached vs. Redis? [closed]
We're using a Ruby web-app with Redis server for caching. Is there a point to test Memcached instead?
What will give us better performance? Any pros or cons between Redis and Memcached?
Points to ...
1158
votes
58
answers
583k
views
How to force browsers to reload cached CSS and JS files?
I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even between browser sessions. This leads to a problem when you ...
1104
votes
25
answers
145k
views
Is Safari on iOS 6 caching $.ajax results?
Since the upgrade to iOS 6, we are seeing Safari's web view take the liberty of caching $.ajax calls. This is in the context of a PhoneGap application so it is using the Safari WebView. Our $.ajax ...
1091
votes
10
answers
646k
views
What is __pycache__?
From what I understand, a cache is an encrypted file of similar files.
What do we do with the __pycache__ folder? Is it what we give to people instead of our source code? Is it just my input data? ...
882
votes
10
answers
215k
views
What is a "cache-friendly" code?
What is the difference between "cache unfriendly code" and the "cache friendly" code?
How can I make sure I write cache-efficient code?
733
votes
9
answers
534k
views
What's the difference between Cache-Control: max-age=0 and no-cache?
The header Cache-Control: max-age=0 implies that the content is considered stale (and must be re-fetched) immediately, which is in effect the same thing as Cache-Control: no-cache.
728
votes
9
answers
829k
views
Read whole ASCII file into C++ std::string [duplicate]
I need to read a whole file into memory and place it in a C++ std::string.
If I were to read it into a char[], the answer would be very simple:
std::ifstream t;
int length;
t.open("file.txt"); /...
711
votes
30
answers
621k
views
How can I force clients to refresh JavaScript files?
We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. ...
665
votes
18
answers
1.3m
views
How to clear gradle cache?
I'm trying to use Android Studio, and the first time I boot it up, it takes like 45 MINUTES to compile... If I don't quit the application, it is okay - each subsequent compilation/running the app will ...
494
votes
6
answers
961k
views
Is there a <meta> tag to turn off caching in all browsers? [duplicate]
I read that when you don't have access to the web server's headers you can turn off the cache using:
<meta http-equiv="Cache-Control" content="no-store" />
But I also read that this doesn't ...
413
votes
6
answers
609k
views
What requests do browsers' "F5" and "Ctrl + F5" refreshes generate?
Is there a standard for what actions F5 and Ctrl+F5 trigger in web browsers?
I once did experiment in IE6 and Firefox 2.x. The F5 refresh would trigger a HTTP request sent to the server with an If-...
373
votes
8
answers
144k
views
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 ...
369
votes
23
answers
804k
views
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 ...
325
votes
8
answers
288k
views
Java time-based map/cache with expiring keys [closed]
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 ...
315
votes
26
answers
513k
views
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 ...
286
votes
12
answers
104k
views
Is Redis just a cache?
I can't see any difference between Redis and caching technologies like Velocity or the Enterprise Library Caching Framework. You're effectively just adding objects to an in-memory data store using a ...
279
votes
10
answers
474k
views
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 ...
270
votes
20
answers
229k
views
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 ...
268
votes
16
answers
389k
views
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 ...
260
votes
14
answers
235k
views
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 ...
255
votes
16
answers
137k
views
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 ...
247
votes
14
answers
175k
views
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 ...
232
votes
6
answers
182k
views
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 ...
230
votes
5
answers
212k
views
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 ...
229
votes
5
answers
131k
views
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 ...
228
votes
5
answers
484k
views
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 ...
221
votes
23
answers
681k
views
Clear the cache in JavaScript
How do I clear a browsers cache with JavaScript?
We deployed the latest JavaScript code but we are unable to get the latest JavaScript code.
Editorial Note: This question is semi-duplicated in the ...
215
votes
2
answers
97k
views
Redis cache vs. using memory directly
I have not used Redis yet, but I have heard about it and plan to try using it for caching data.
I have heard that Redis uses memory as a cache store database. What's the point of Redis, since I can ...
213
votes
12
answers
156k
views
AngularJS disable partial caching on dev machine
I have problem with caching partials in AngularJS.
In my HTML page I have:
<body>
<div ng-view></div>
<body>
where my partials are loaded.
When I change HTML code in my ...
211
votes
7
answers
163k
views
Cache an HTTP 'Get' service response in AngularJS?
I want to be able to create a custom AngularJS service that makes an HTTP 'Get' request when its data object is empty and populates the data object on success.
The next time a call is made to this ...
204
votes
8
answers
143k
views
Disable browser cache for entire ASP.NET website
I am looking for a method to disable the browser cache for an entire ASP.NET MVC Website
I found the following method:
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response....
204
votes
14
answers
256k
views
What is the difference between buffer and cache memory in Linux?
To me it's not clear what's the difference between the two Linux memory concepts : buffer and cache. I've read through this post and it seems to me that the difference between them is the expiration ...
203
votes
9
answers
109k
views
Programmatically get the cache line size?
All platforms welcome, please specify the platform for your answer.
A similar question: How to programmatically get the CPU cache page size in C++?
203
votes
8
answers
305k
views
Laravel 5 Clear Views Cache
I notice that Laravel cache views are stored in ~/storage/framework/views. Over time, they get to eat up my space. How do I delete them? Is there any command that could? I tried php artisan cache:...
189
votes
3
answers
200k
views
Notepad++ cached files location
On the most recent versions of Notepad++, when the application is closed, unsaved files are maintained when the application is restarted.
I presume that those files are cached on a temporary files. ...
189
votes
15
answers
176k
views
Spring Cache @Cacheable - not working while calling from another method of the same bean
Spring cache is not working when calling cached method from another method of the same bean.
Here is an example to explain my problem in clear way.
Configuration:
<cache:annotation-driven cache-...
186
votes
26
answers
277k
views
How to force Chrome browser to reload .css file while debugging in Visual Studio?
I'm currently editing a .css file inside of Visual Studio 2012 (in debug mode). I'm using Chrome as my browser. When I make changes to my application's .css file inside of Visual Studio and save, ...
181
votes
15
answers
76k
views
How does one write code that best utilizes the CPU cache to improve performance?
This could sound like a subjective question, but what I am looking for are specific instances, which you could have encountered related to this.
How to make code, cache effective/cache friendly (more ...
180
votes
4
answers
306k
views
Clear MySQL query cache without restarting server
Is there any way to clear mysql query cache without restarting mySQL server?
177
votes
5
answers
295k
views
Write-back vs Write-Through caching?
My understanding is that the main difference between the two methods is that in "write-through" method data is written to the main memory through the cache immediately, while in "write-...
175
votes
5
answers
28k
views
What is the difference between Caching and Memoization?
I would like to know what the actual difference between caching and memoization is.
As I see it, both involve avoiding repeated function calls to get data by storing it.
What's the core difference ...
175
votes
21
answers
133k
views
How would you implement an LRU cache in Java?
Please don't say EHCache or OSCache, etc. Assume for purposes of this question that I want to implement my own using just the SDK (learning by doing). Given that the cache will be used in a ...
174
votes
4
answers
146k
views
What is Cache-Control: private?
When I visit chesseng.herokuapp.com I get a response header that looks like
Cache-Control:private
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/css
Date:Tue, 16 Oct 2012 06:37:53 GMT
...
173
votes
19
answers
221k
views
How to clear APC cache entries?
I need to clear all APC cache entries when I deploy a new version of the site.
APC.php has a button for clearing all opcode caches, but I don't see buttons for clearing all User Entries, or all System ...
171
votes
15
answers
476k
views
How to programmatically empty browser cache?
I am looking for a way to programmatically empty the browser cache. I am doing this because the application caches confidential data and I'd like to remove those when you press "log out". This would ...
168
votes
3
answers
164k
views
How do I request a file but not save it with Wget? [closed]
I'm using Wget to make http requests to a fresh web server. I am doing this to warm the MySQL cache. I do not want to save the files after they are served.
wget -nv -do-not-save-file $url
Can I do ...