Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
Cache-Control header in firebase.json not working
The Cache-Control header in my firebase.json does not seem to be working. The max-age value for all files is set to 31536000 (1 year), but when loading the page it is still set to the browser default of 3600 (1 hour). The firebase.json file seems to abide by the firebase documentation. { "hosting": { "publ...
24 According to full page configuration you have to set hosting key first. This has to work: { "hosting": { "public": "app", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "headers": [{ "source" : "**", "heade...
How to disable cache of Apache?
I put only index.html in /var/www/html. The page doesn't update after I changed the contents of index.html and reload. I already disable cache_module in httpd.conf like this below. # LoadModule cache_module modules/mod_cache.so # LoadModule disk_cache_module modules/mod_disk_cache.so
if you are using htaccess then you can do like #Initialize mod_rewrite RewriteEngine On <FilesMatch "\.(html|htm|js|css)$"> FileETag None <IfModule mod_headers.c> Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expi...
Under what conditions will the browser cache <video> files?
Under what conditions will the browser cache files? Sometimes it does, sometimes it doesn't. If no one here knows, my next step will be to test the various file format, file size, and htaccess scenarios. If you don't know, can you think of any other variables that you'd recommend testing? Thanks in advance!
The following works to instruct the browser to cache the files. The last line was necessary to make the server deliver webm files with the correct header MIME type. # Expires is set to a point we won't reach, # Cache control will trigger first, 10 days after access # 10 Days = 60s x 60m x 24hrs x 10days = 864,000 <Fi...
What is the most efficient way to store / retrieve items in asp.net httpContext.Cache
I have a website where I cache a lot of info. I am seeing conflicting information around storing stuff in the asp.net cache. For example lets say I have this data structure: Dictionary<string, List<Car>> mydictionary; I could store the whole thing with a string key as "MyDictionary" and then drill down once i pull ...
Adding an additional answer here as I feel the existing one capture the 'what' but not enough of the 'why'. The reason it's best to store individual entries separately in the cache have little to do with perf. Instead, it has to do with allowing the system to perform proper memory management. There is a lot of logic i...
How can I access HTTP Cache in a C# class library?
How can I access HTTP Cache in a C# class library ?
It is recommended that you use System.Web.HttpRuntime.Cache rather than System.Web.HttpContext.Current.Cache, as explained in this article. Additionally, while the article talks about performance, I've also had issues in the past where HttpContext.Current isn't always available when you'd expect it to be, especially w...
Nginx, turn off cache for a specific file
location /static { alias /home/ubuntu/Documents/zibann/momsite/momsite/static; # your Django project's static files - amend as required if ($uri ~* ".*config.js") { expires off; } if ($uri ~* ".*\.(js|css|png|jpg|jpeg|gif|swf|svg)" ) { access_log off; expires 365d; add_head...
Make a separate location block for config.js above the others. location ~ config\.js { alias xyz; expires off; } location static etc
filectime vs filemtime for file modification time?
I'm trying to ensure some images aren't cached when they're modified but which would be more suitable for this filectime or filemtime? I can't really see much difference from the php manuals? Would either be faster? <img src="/images/123.png?<?=md5(@filectime("/images/123.png"))?>" /> <img src="/images/123.png?<?=md5(...
As you're dealing with image caching, filectime is inappropriate - it marks the last time: when the permissions, owner, group, or other metadata from the inode is updated source: php.net You want to know if the image file content has changed - if it's been resized, cropped or replaced entirely. Therefore, filemtime ...
How to use System.Web.Caching in asp.net?
I have a class that looks like this: using System.Collections.Generic; using System.Web.Caching; public static class MyCache { private static string cacheKey = "mykey"; public static Dictionary<string, bool> GetCacheValue(bool bypassCache) { var settings = Cache[cacheKey] as Dictionary<string, bo...
System.Web.Caching.Cache is a class - you see people using a property named Cache that is an instance of System.Web.Caching.Cache. If you're using it outside of a class that provides you with the Cache property, access it using System.Web.HttpRuntime.Cache: var settings = System.Web.HttpRuntime.Cache[cacheKey] as Dic...
How to mark some memory ranges as non-cacheable from C++?
I was reading the wikipedia on the CPU cache here: http://en.wikipedia.org/wiki/CPU_cache#Replacement_Policies Marking some memory ranges as non-cacheable can improve performance, by avoiding caching of memory regions that are rarely re-accessed. This avoids the overhead of loading something into the cache, without h...
On Windows, you can use VirtualProtect(ptr, length, PAGE_NOCACHE, &oldFlags) to set the caching behavior for memory to avoid caching. Regarding too many indirections: Yes, they can damage cache performance, if you access different pieces of memory very often (which is what happens usually). It's important to note, tho...
Getting Varnish To Work on Magento
First please forgive me for total lack of understanding of Varnish. This is my first go at doing anything with Varnish. I am following the example at: http://www.kalenyuk.com.ua/magento-performance-optimization-with-varnish-cache-47.html However when I install and run this, Varnish does not seem to cache. I do get the...
http://moprea.ro/2011/may/6/magento-performance-optimization-varnish-cache-3/ describes the Magento extension that enables full page cache with varnish. This extension relies on Varnish config published on github. These are the features already implemented: Workable varnish config Enable full page caching using Varni...
NSURLCache does not clear stored responses in iOS8
Here is the sample function I call when i need to clear cache and make a new call to URL - (void)clearDataFromNSURLCache:(NSString *)urlString { NSURL *requestUrl = [NSURL URLWithString:urlString]; NSURLRequest *dataUrlRequest = [NSURLRequest requestWithURL: requestUrl]; NSURLCache * cache =[NSURLCache sh...
NSURLCache is broken on iOS 8.0.x - it never purges the cache at all, so it grows without limit. See http://blog.airsource.co.uk/2014/10/11/nsurlcache-ios8-broken/ for a detailed investigation. Cache purging is fixed in the 8.1 betas - but removeCachedResponseForRequest: is not. removeCachedResponsesSinceDate: does ap...
Make an ASP.NET MVC application Web Farm Ready
What will be the most efficient way to make an ASP.NET MVC application web-farm ready. Most importantly sharing the current user's information (Context) and (not so important) cached objects such as look-up items (States, Street Types, counties etc.). I have heard of/read MemCache but haven't seen a simple applicable...
Request context Any request that hits a web farm gets served by an available IIS server. Context gets created there and the whole request gets served by the same server. So context shouldn't be a problem. A request is a stateless execution pipeline so it doesn't need to share data with other servers in any way shape o...
Remove old AndroidStudio Cache folders - OSX
Hi I notice that I have large folders <1Gb from AndroidStudio on Libraries/Cache OSX 10.9 The folders are: AndroidStudio AndroidStudio1.3 AndroidStudioBeta AndroidStudioPreview1.3 AndroidStudioPreview1.4 I'm using AndroidStudio 1.4 beta 4 currently Can I safe delete some of these cache folders? Do you know what woul...
It's safe generally, The cache in /System/Library/Caches is useful for system but the cache in ~/Library/Caches are not that useful. Deleting everything at once is not recommended. But if you want to delete specific file remove it manually
Check if Volley gets results from cache or over network
How can I check whether Volley gets the results of a JsonObjectRequest from the cache or from the network? I need to show a progress dialog when it needs a network connection but not when the results are quickly received from the cache. my request looks something like this volleyQueue = Volley.newRequestQueue(this); J...
I did this by overriding Request#addMarker and checking for a "cache-hit" marker being added: public class MyRequest<T> extends Request<T> { protected boolean cacheHit; @Override public void addMarker(String tag) { super.addMarker(tag); cacheHit = false; if (tag.equals("cache-hit...
python threadsafe object cache
I have implemented a python webserver. Each http request spawns a new thread. I have a requirement of caching objects in memory and since its a webserver, I want the cache to be thread safe. Is there a standard implementatin of a thread safe object cache in python? I found the following http://freshmeat.net/projects/...
Well a lot of operations in Python are thread-safe by default, so a standard dictionary should be ok (at least in certain respects). This is mostly due to the GIL, which will help avoid some of the more serious threading issues. There's a list here: http://coreygoldberg.blogspot.com/2008/09/python-thread-synchroniza...
caching issue with web application developed using reactjs & webpack
I am working on a web application developed using reactjs and webpack. After every deployment, we have to ask users to clear the browser cache and restart their browsers. I think the javascript bundle file and css file both are getting cached on user browser. How can we force browser not to cache these files or make ...
12 You can use html-webpack-plugin plugins: [ new HtmlWebpackPlugin({ hash: true }) ] hash: true | false if true then append a unique webpack compilation hash to all included scripts and css files. This is useful for cache busting. Share Improve...
Arrays vs Linked Lists in terms of locality
Say we have an unsorted array and linked list. The worst case when searching for an element for both data structures would be O( n ), but my question is: Would the array still be way faster because of the use of spatial locality within the cache, or will the cache make use of branch locality allowing linked lists to b...
Your understanding of the the array case is mostly correct. If an array is accessed sequentially, many processors will not only fetch the block containing the element, but will also prefetch subsequent blocks to minimize cycles spent waiting on cache misses. If you are using an Intel x86 processor, you can find deta...
Asp.Net Cache, modify an object from cache and it changes the cached value
I'm having an issue when using the Asp.Net Cache functionality. I add an object to the Cache then at another time I get that object from the Cache, modify one of it's properties then save the changes to the database. But, the next time I get the object from Cache it contains the changed values. So, when I modify the...
The cache does just that, it caches whatever you put into it. If you cache a reference type, retrieve the reference and modify it, of course the next time you retrieve the cached item it will reflect the modifications. If you wish to have an immutable cached item, use a struct. Cache.Insert("class", new MyClass() { T...
Completely disable IPython output caching
I'm dealing with some GB-sized numpy arrays in IPython. When I delete them, I definitely want them gone, in order to recover the memory. IPythons output cache is quite annoying there, as it keeps the objects alive even after deleting the last actively intended reference to them. I already set c.TerminalInteractiveShel...
Looking at IPython/core/displayhook.py Line 209-214 I would say that it is not configurable. You could try making a PR to add an option to disable it totally.
Is it possible for CloudFront to cache REST API calls
I have a Single Page Application, and would like to cache some of the public REST API calls. Is it possible to use CloudFront to cache the JSON result of those API calls?
You can point api.yourdomain.com to cloudfront domain. Cloudfront will cache the json response based on your cache control headers. However, you'll likely have to deal with cross domain issue if your single page app is not served from api.yourdomain.com. Cloudfront supports OPTIONS request which means it should be abl...
Clear Cache in iOS: Deleting Application Data of Other Apps
Recently, I have came across many apps which "Clear Cache" on iPhone. They also specify that you may lose some saved data and temp files. What I know is that Apple doesn't allows you to access data of other Apps neither directory. So, how they are cleaning cache data? Can anyone put some light on it? Reference: Magic ...
13 +150 They simply fill the free space on iPhone temporarily with random data leaving the system with no free space at all. This forces iOS to clear all temp data, caches and iCloud Photos -if you enabled storage optimization- to clear ...
How to preload Leaflet tiles of known bounds in browser cache for faster display?
I'm developing a web application which displays animated markers on a Leaflet map. The map is programmatically zoomed to the first animation bounds, then the animation is played, then the map is zoomed to the second animation bounds and the second animation is played, and so on... My problem is that the OpenStreetMap ...
There are 2 questions in one: 1/ How to preload tiles ? Tiles are images. You just have to create a reference to these images. Look at JavaScript Preloading Images 2/ What tiles must you load when you know the boundaries ? Take a look at https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames I cooked an example her...
When an Expression<T> is compiled, is it implicitly cached?
When an Expression<T> is compiled, is the resultant code implicitly cached by the framework? I'm thinking along the lines of the static Regex methods where the framework implicitly compiles and caches the last few regexes. If compiled Expression<T> objects are not cached, can you recommend some best practices for keep...
No; I do not believe that it is; if you want it cached, you must hold onto the Delegate reference (typically Func<...> or Action<...>). Likewise, if you want to get the best performance, you would compile it as a parameterised expression, so you can send in different values when you invoke it. In this case, re-phrasin...
Example of JakeWhartons DiskLruCache
I want to use the DiskLruCache from Jake Wharton in my Android app based on API Level 7+. I would use it in my ListView to Cache downloaded images on SdCard but i didn't understood the usage of this library. Can anybody show me a example of how to get Bitmaps from this Cache or put Bitmaps in the cache? ( key = filePa...
I used getBitmap() in the sample someone posted here. This is the answer you're looking for under a different title. You will have to create a Utils for some of the code but it's pretty straightforward. Good Luck! Using DiskLruCache in android 4.0 does not provide for openCache method
How to programmatically invalidate Bitbucket Pipeline's cache?
I have a node_modules cache in my Bibucket Pipeline and I added new module (eg yarn add react-modal) - how to make Bitbucket pipelines detect new yarn.lock and invalidate its cache?
5 Yeah, as Marecky have already mentioned, there is a ticket for that. Also, there is another one here https://jira.atlassian.com/browse/BCLOUD-17605, which should exactly address the issue. In short, there is an API to invalidate the cache, but it's currently reserved fo...
Spring boot cache No cache could be resolved for Builder
According to link, the simplest configuration to use cache in spring boot is using CacheManager (an cache Map would be initialized in this class): @Configuration @EnableCaching public class CacheService extends CachingConfigurerSupport { @Bean public CacheManager concurrentMapCacheManager() { Concurren...
8 I am using Ehcache and i had the same issue because i had two different names for cache and Cacheable. Please make you use same name for cache and Cacheable. @Cacheable("codetable") <cache name="codetable" maxEntriesLocalHeap="100" maxEntriesLocalDisk=...
How to clear the cache in Solr?
I'm trying to compare the performance of different Solr queries. In order to get a fair test, I want to clear the cache between queries. How is this done? Of course, one can restart the server, I was curious if there is a quicker way.
7 I'm using version 4.2.1 and even with autowarmCount="0" the cache is not updated after doing a Dataimport. In that case, on Solr Admin (usually http://localhost:8983/) Go to Core Admin and click Reload. When refreshed, you should see a green check mark on the "current" f...
Guava CacheBuilder maximumSize
I'm trying to figure out what the number that you specify in Guava CacheBuilder maximumSize() represent. Say I've got something like this in my code, Cache<String, Object> programCache = CacheBuilder.newBuilder() .maximumSize(1000) .build(); Does the 1000 that I specified as the max size mean that I can have ...
9 The maximumSize() method refers to the (approximate) maximum number of entries in the cache. It makes no guarantees about how much memory the cache's contents will consume (and as Louis points out, there's no reasonable way for any Java object to do so). If you have a way...
Android - drawing cache - when is it useful?
I am reading about setDrawingCacheEnabled and getDrawingCache and I was wondering when is it good to use it or when its not good. Basically in my case I have an HorizontalScrollView with many things inside it so its scrolls left/right and most of the things are not visible. If I use setDrawingCacheEnabled(true) on the...
TouchInterceptor.java - This is class responsible for reordering your playlist in the default music player. It uses setDrawingCacheEnabled when you start dragging the current view. Basically, it creates a bitmap from the ListView item and drag it. Take a closer look at onInterceptTouchEvent method.
retaining cache in firefox and chrome browser - Selenium WebDriver
Currently our web application takes around 3 mins to load completely without caching and 10 secs with caching. When I open the app through WebDriver its taking around 3 mins to load i.e. caching is not used. I observed this on Firefox and Chrome browser. Not sure how to enabled the driver to use cache instead of loadi...
8 The problem is, that selenium copies every startup a new (firefox/chrome) profile to the temp directory and starts firefox/chrome with it. However, it is possible to always use the same profile for your test instances. I think this way you can get it working faster. For ...
how to read a cached xml file?
have a file caching system for a php 5 library i use often. when the request is made i check for a cached file, if there is one i render it and exit. $contents = file_get_contents( self::_cacheFile() ); echo $contents; exit(); i have to do file_get_contents instead of just include because of cached xml files wit...
If all you want to do is output the file contents, you should be using readfile(). This is faster and less memory intensive than file_get_contents()
Clear Cache memory of Picasso
I'm trying to clear the cache memory of Picasso via Android coding. Can anyone please help me in this issue..? I have tried using the following code, but this was not useful in my case: Picasso.with(getActivity()).load(data.get(pos).getFeed_thumb_image()).skipMemoryCache().into(image);
if you are trying to load an image through Json(from db) try clearing the networkCache for a better result. Picasso.with(context).load(uri).networkPolicy(NetworkPolicy.NO_CACHE) .memoryPolicy(MemoryPolicy.NO_CACHE) .placeholder(R.drawable.bv_logo_default).stableKey(id) .into(viewImage_imageView...
Force re-cache of WSDL in php
I know how to disable WSDL-cache in PHP, but what about force a re-caching of the WSDL? This is what i tried: I run my code with caching set to disabled, and the new methods showed up as espected. Then I activated caching, but of some reason my old non-working wsdl showed up again. So: how can I force my new WSDL to ...
I guess when you disable caching it will also stop writing to the cache. So when you re-enable the cache the old cached copy will still be there and valid. You could try (with caching enabled) ini_set('soap.wsdl_cache_ttl', 1); I put in a time-to-live of one second in because I think if you put zero in it will disabl...
client-side file caching
If I understand correctly, a broswer caches images, JS files, etc. based on the file name. So there's a danger that if one such file is updated (on the server), the browser will use the cached copy instead. A workaround for this problem is to rename all files (as part of the build), such that the file name includes an...
The best solution seems to be to version filenames by appending the last-modified time. You can do it this way: add a rewrite rule to your Apache configuration, like so: RewriteRule ^(.+)\.(.+)\.(js|css|jpg|png|gif)$ $1.$3 This will redirect any "versioned" URL to the "normal" one. The idea is to keep your filenames ...
"Lazy load" of data from a context processor
In each view of my application I need to have navigation menu prepared. So right now in every view I execute complicated query and store the menu in a dictionary which is passed to a template. In templates the variable in which I have the data is surrounded with "cache", so even though the queries are quite costly, it...
Django has a SimpleLazyObject. In Django 1.3, this is used by the auth context processor (source code). This makes user available in the template context for every query, but the user is only accessed when the template contains {{ user }}. You should be able to do something similar in your context processor. from djan...
How can I cache a calculated column in rails?
I have a tree of active record objects, something like: class Part < ActiveRecord::Base has_many :sub_parts, :class_name => "Part" def complicated_calculation if sub_parts.size > 0 return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_calculation } else sleep(1) retur...
You can stuff the actually cached values in the Rails cache (use memcached if you require that it be distributed). The tough bit is cache expiry, but cache expiry is uncommon, right? In that case, we can just loop over each of the parent objects in turn and zap its cache, too. I added some ActiveRecord magic to you...
rails caching: expire_action in another namespace
My application is using a namespace for administrative purposes. I recently tried to start using action caching however I ran into some problems trying to expire the cache using expire_action. Basically I have a index action in my default namespace newsposts controller that is cached using action caching like this: cl...
after some more digging I finally found the solution. It's a bit hinted in the url_for method: In particular, a leading slash ensures no namespace is assumed. Thus, while url_for :controller => 'users' may resolve to Admin::UsersController if the current controller lives under that module, url_for :controller => '/use...
Will an image with style="display: none" still be downloaded and cached?
I'm trying to figure out a way to cache the next and previous images in my gallery script ... I'm wondering if this is a good way to do it. Also, is there any way to manually specify the cache time for the downloaded image?
display: none images will be downloaded and cached on the client. However, JavaScript already has a well-defined way of preloading images: var nextImage = new Image(); nextImage.src = "your-url/newImage.gif"; This will preload an image without displaying it to the user.
Expire Output Cache ASP.Net MVC
I am using the standard outputcache tag in my MVC app which works great but I need to force it to be dumped at certain times. How do I achieve this? The page that gets cached is built from a very simple route {Controller}/{PageName} - so most pages are something like this: /Pages/About-Us Here is the output cache ta...
Be careful about using "None" vs. "". If you send "" then the HttpHeader for Vary is not sent. If you send "None" then the HttpHeader for Vary is sent. I used Fiddler to verify this behavior. This seems to have an impact on whether or not the browser goes back to the server to check for latest version (causing a 304...
Spark SQL: how to cache sql query result without using rdd.cache()
Is there any way to cache a cache sql query result without using rdd.cache()? for examples: output = sqlContext.sql("SELECT * From people") We can use output.cache() to cache the result, but then we cannot use sql query to deal with it. So I want to ask is there anything like sqlcontext.cacheTable() to cache the resu...
You should use sqlContext.cacheTable("table_name") in order to cache it, or alternatively use CACHE TABLE table_name SQL query. Here's an example. I've got this file on HDFS: 1|Alex|[email protected] 2|Paul|[email protected] 3|John|[email protected] Then the code in PySpark: people = sc.textFile('hdfs://sparkdemo:802...
Does the ETag header make the Cache-Control header obsolete? How to make sure Cache-Control is not harmful then?
Definition of ETag header (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag): The ETag HTTP response header is an identifier for a specific version of a resource. It allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has no...
After some research, I found a great tutorial on Medium by Alex Barashkov: "Best practices for cache control settings for your website". Alex writes: I recommend you apply Cache-Control: no-cache to html files. Applying “no-cache” does not mean that there is no cache at all, it simply tells the browser to validat...
Prefetching data to cache for x86-64
In my application, at one point I need to perform calculations on a large contiguous block of memory data (100s of MBs). What I was thinking was to keep prefetching the part of the block my program will touch in future, so that when I perform calculations on that portion, the data is already in the cache. Can someone...
gcc uses builtin functions as an interface for lowlevel instructions. In particular for your case __builtin_prefetch. But you only should see a measurable difference when using this in cases where the access pattern is not easy to predict automatically.
Best way to implement LRU cache
I was looking at this problem of LRU cache implementation where after the size of the cache is full, the least recently used item is popped out and it is replaced by the new item. I have two implementations in mind: 1). Create two maps which looks something like this std::map<timestamp, k> time_to_key std::map<key, st...
If you want an LRU cache, the simplest in Java is LinkedHashMap. The default behaviour is FIFO however you can changes it to "access order" which makes it an LRU cache. public static <K,V> Map<K,V> lruCache(final int maxSize) { return new LinkedHashMap<K, V>(maxSize*4/3, 0.75f, true) { @Override pr...
Why would a region of memory be marked non-cached?
In an embedded application, we have a table describing the various address ranges that are valid on our target board. This table is used to set up the MMU. The RAM address range is marked as cacheable, but other regions are not. Why is that?
If a memory region is accessed by both hardware and software simultaneously (EX: hardware configuration register or scatter-gather list for DMA), this region must be defined as non-cached. For actual DMA, the memory buffer can be defined as cached, and in most cases, it is advisable for the buffer to be cached to allo...
std::bind vs lambda performance
I wanted to time a few functions' execution and I've written myself a helper: using namespace std; template<int N = 1, class Fun, class... Args> void timeExec(string name, Fun fun, Args... args) { auto start = chrono::steady_clock::now(); for(int i = 0; i < N; ++i) { fun(args...); } auto end...
I assume that lambda cannot be that better than bind. That's quite a preconception. Lambdas are tied into the compiler internals, so extra optimization opportunities may be found. Moreover, they're designed to avoid inefficiency. However, there are probably no compiler optimization tricks happening here. The likely ...
How to cache images and html files in PhoneGap
I need a way for cache images and html files in PhoneGap from my site. I'm planning that users will see site without internet connection like it will be with it. But I see information only about sql data storing, but how can I store images (and use later).
Caching like you might need for simple offline operation is not exactly that easy. Your first option is the cache manifest. It has some limitations (like the size of the cache) but might work for you since it was designed to do what you want. Another options is that you can store content on the disk of the device usin...
How to disable caching for all WebApi responses in order to avoid IE using (from cache) responses
I have a simple ASP.NET Core 2.2 Web Api controller: [ApiVersion("1.0")] [Route("api/[controller]")] [ApiController] public class TestScenariosController : Controller { [HttpGet("v2")] public ActionResult<List<TestScenarioItem>> GetAll() { var entities = _dbContext.TestScenarios.AsNoTracking().Selec...
You can add ResponseCacheAttribute to the controller, like this: [ApiVersion("1.0")] [Route("api/[controller]")] [ApiController] [ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)] public class TestScenariosController : Controller { ... } Alternatively, you can add ResponseCacheAttribute as a g...
What does `expires -1` mean in NGINX `location` directive?
Given the sample location example below, what does -1 mean for expires? Does that mean "never expires" or "never caches"? # cache.appcache, your document html and data location ~* \.(?:manifest|appcache|html?|xml|json)$ { expires -1; access_log logs/static.log; } https://github.com/h5bp/server-configs-nginx/blob/...
According to nginx manual, this directive adds the Expires and Cache-Control HTTP header to the response. Value -1 means these headers are set as: Expires: current time minus 1 second Cache-Control: no-cache So in summary it instructs the browser not to cache the document.
Caching domain objects in Grails
I have been considering implementing EhCache in my Grails domain objects like this : static mapping = { cache true } I am not too familiar with exactly how this caching mechanism works and was wondering what a good rule of thumb is in determining which domain objects would benefit from being cached. eg, objects th...
Caching only works for get() calls by default, but queries use the query cache if you update them with cache: true (criteria and HQL). cache true creates a read-write cache but you can configure a read-only cache with static mapping = { cache usage:'read-only' } The read-only cache is good for lookup data that nev...
Prevent Firefox from caching localhost?
I've been curious to try switching to Firefox Quantum from Chrome, but for web development have hit a major obstacle that I have not been able to easily resolve –– it's caching my localhost files so when I attempt to load various ember applications at localhost:4200 I end up viewing a cached application different than...
And/or how to developers normally work with Firefox in this regard? I tend to use CTRL + F5 to do hard reload (ignores cache). Pretty standard for all browsers. Since there is no native way to configure for individual domains, you could write a Browser Extension that can intercept responses via the webRequest API (s...
Cache layer for MVC - Model or controller?
I am having some second thoughts about where to implement the caching part. Where is the most appropriate place to implement it, you think? Inside every model, or in the controller? Approach 1 (psuedo-code): // mycontroller.php MyController extends Controller_class { function index () { $data = $this->mo...
Caching should be done in the model. If I had to choose in general, I would probably end up transparently caching the model's database interaction, which wouldn't require you to make any changes to the rest of your code. This of course would be done in the parent class of your models. Definitely focus on caching your ...
How to use "cache" method of Mono
I'm a beginner of spring webflux. While researching I found some code like: Mono result = someMethodThatReturnMono().cache(); The name "cache" tell me about caching something, but where is the cache and how to retrieve cached things? Is it something like caffeine?
It cache the result of the previous steps of the Flux/Mono until the cache() method is called, check the output of this code to see it in action: import reactor.core.publisher.Mono; public class CacheExample { public static void main(String[] args) { var mono = Mono.fromCallable(() -> { Syste...
Reload/Refresh cache in spring boot
I am using Spring Boot and for caching I am using Ehcache. It's working fine till now. But now I have to reload / refresh so how can I do this so that my application will not be having any downtime. I have tried many ways in Spring Ehcache but it didn't work or Else have to write a scheduler and reload the data...
18 Apparently all the comments about your problem were right. You should use CacheEvict. I found solution here: https://www.baeldung.com/spring-boot-evict-cache and it looks like this: All you have to do is create class called e.g. CacheService and create method that will e...
Does Go cache DNS lookups?
I am building a test crawler and wanted to know if Go (golang) caches DNS queries. I don't see anything about caching in the dnsclient. This seems like an important thing to add to any crawler to prevent lots of extra DNS queries. Does Go (1.4+) cache DNS lookups? If not, does debian/ubuntu/linux, windows, or darwin/...
The answer to your question is no. There is no built-in dns caching in the std lib resolver. Would it be helpful? Maybe in some cases. Our org runs a local dns cache on each server and points resolv.conf there. So it wouldn't necessarily help us much to have caching in the language. There are some solutions that could...
Choosing between Scons and Waf in Large Projects
We are thinking about converting a really large project from using GNU Make to some more modern build tool. My current suggestion is to use SCons or Waf. Currently: Build times are around 15 minutes. Around 100 developers. About 10 percent of code is C/C++/Fortran rest is Ada (using gnatmake). Potential hopes/gains ...
10 I have been developing a tool chain for our company that is built around waf. It targets Fedora, Ubuntu, Arch, Windows, Mac OSX and will be rolled out to our embedded devices doing cross-compilation on various hosts. We have found the way that waf allows contained exten...
Clearing TortoiseSVN authentication cache from the command line
TortoiseSVN is nice for the most part, but one thing that blows in a team development situation where more than one person is using a particular PC is the authentication. When I'm working on stuff, I like to save my credentials so that I don't need to keep entering it in for logging, branching, committing, etc. The p...
You have to delete the files manually, like so (using .bat file): @echo off rmdir /s /q "%APPDATA%\Subversion\auth" See the Authentication section of the TortoiseSVN documentation.
Google Maps v3 - Map tile caching on client?
I'm using Google Maps JS API v3 for a project. Is there a way to ask the map to cache tiles on the client's machine so that when they refresh the browser, the tiles don't have to all download again? Many of my clients are on cellular connections where redownloading the map takes a considerable amount of time. Thanks!
By default google maps return's cached images (you can see this in the network tab of the console). If you user's having trouble caching the images, it's probably because they disabled the cache
Fastest PHP memory cache/hashtable [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be imp...
If you dont have APC or Memcached installed already (or dont want to use them for this) you can also create a RAM disk. Then use file_get_contents() and file_put_contents() where filename is your key and the file content is your value. I dont have numbers for that, but it should be fast.
How to clear the DataContext cache on Linq to Sql
I'm using Linq to Sql to query some database, i only use Linq to read data from the DB, and i make changes to it by other means. (This cannot be changed, this is a restriction from the App that we are extending, all updates must go trough its sdk). This is fine, but I'm hitting some cache problems, basically, i query ...
If you want to refresh a specific object, then the Refresh() method may be your best bet. Like this: Context.Refresh(RefreshMode.OverwriteCurrentValues, objectToRefresh); You can also pass an array of objects or an IEnumerable as the 2nd argument if you need to refresh more than one object at a time. Update I see wha...
Leverage browser caching
According to: http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching I should be using browser caching. However, I don't know how. Do I simply add certain tags into the html section? Or is thing something I need to send via to server to the client? something to do with php headers?
Caching is controlled via a variety of HTTP headers. You should read Mark Nottingham's Caching Tutorial for Web Authors and Webmasters. You can set HTTP headers for documents outputted from PHP using the header function.
Can I get expiration time of specified key in django cache?
It must be stored somewhere. I can change it with set()/incr(), but I couldn't find the way to read it.
cache._expire_info.get('foo') to get the unix timestamp
Does anyone know of any issues using a querystring within a CSS file?
We're making changes to our main sprite and I'm debating the benefits of either changing its name completely or adding a query string to the end. There's logic to keeping the old version to support Google cache, archive.com, etc., but it'd also be much cleaner on our system if I was to just edit the file and add a que...
Unless the browser is seriously broken, there should be nothing wrong. Suppose you wanted to use a dynamic file, such as url('/layout.php?section=1') or something. Query strings are kind of required there, so if the browser didn't work it'd be broken quite badly.
Browser Cache Vs HTML5 Application Cache
Is HTML5 Application Cache different from browser cache?? If so, in what aspects, it is different and how this mechanism works?? And tell me how using AppCache we can improve browsing performance.. Also discuss about the pros and cons of HTML5 AppCache (its expiry and storage size limit etc.,)??
HTML5 Cache HTML5 provides application cache, which means that a web application is cached, and accessible without an internet connection. Application cache gives an application three advantages: Offline browsing - users can use the application when they're offline Speed - cached resources load faster Reduced server ...
Out of Process in memory database table that supports queries for high speed caching
I have a SQL table that is accessed continually but changes very rarely. The Table is partitioned by UserID and each user has many records in the table. I want to save database resources and move this table closer to the application in some kind of memory cache. In process caching is too memory intensive so it needs t...
Since it's out-of-process, it has to do serialization and deserialization. The problem you concern is how to reduce the serialization/deserizliation work. If you use Redis' STRING type, you CANNOT reduce these work. However, You can use HASH to solve the problem: mapping your SQL table to a HASH. Suppose you have the ...
HTML Cache control
What is the difference between below 3 meta tags? <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="Expires" CONTENT="-1"> Do I need to use all those tags to avoid browser caching?
See the Caching Tutorial for Web Authors and Webmasters which explains about all the different cache control headers (especially the part the explains that those meta tags are largely useless and real HTTP headers are the way forwards).
Disable cache globally .NET
is there a way to disable server caching globally in ASP.NET? Like by adding some sort of setting to the web.config file? So far I've tried adding these and it didnt make a difference... <caching> <sqlCacheDependency enabled="false"></sqlCacheDependency> <outputCache enableOutputCache="fa...
14 There is also a way of disabling this in system.webServer if you are using IIS7/7.5 or IIS Express. This will work in your main web.config file (for both webforms and mvc) and also in web.config files in subfolders, to disable it for particular areas of your application....
Cache is not cleared in Google Chrome
When I deploy the version I will add the number as a query string with the JavaScript and CSS file like following? 'app/source/scripts/project.js?burst=32472938' I am using the above to burst the cache in the browser. But in Firefox, I am getting the latest script that I have modified. But in Chrome, I am not getting...
According to the Google documentation, the best way to invalidate and reload the file is to add a version number to the file name and not as a query parameter: 'app/source/scripts/project.32472938.js' Here is a link to the documentation: https://developers.google.com/web/fundamentals/performance/optimizing-content-eff...
Purging all pages in mediawiki
Is it possible to purge all pages in mediawiki? I've tried emptying the obejctcache table to no avail. I don't particularly want to hit each page with ?action=purge appended. Version 1.23.3
You can either Use the maintainance script PurgeList.php like this: php purgeList.php --purge --all, for MW > 1.21, and php purgeList.php --all-namespaces for MW > 1.34. Really old MW versions do not have the --all option, so you will need a list of pages. Use the API: API:Purge, and feed it with a list of all pages...
Set amount of memory available to AppFabric Caching
How do I set the amount of memory available to the Windows Server AppFabric Caching service? We're running the AppFabric Cache on the same server which is hosting the website, and I'd like to be able to control how much RAM the cache will consume.
You can modify the amount of ram available using this commands on the powerShell console: Stop-cachecluster Set-cacheHostConfig {Machine name} {port(22233)} -CacheSize {cache allocation in MB} Start-cachecluster More info on MSDN
C# - Inserting and Removing from Cache
If I insert to Cache by assigning the value: Cache["key"] = value; what's the expiration time? Removing the same value from Cache: I want to check if the value is in Cache by if(Cache["key"]!=null), is it better to remove it from Cache by Cache.Remove("key") or Cache["key"]=null ? -- Edit -- After having tried ...
1 Cache["key"] = value is equal to Cache.Insert("key", value) MSDN Cache.Insert - method (String, Object): This method will overwrite an existing cache item whose key matches the key parameter. The object added to the cache using this overload of the Insert method is inserted with no file or cache dependenc...
Angular - best way to cache http response
I have a lot of services with requests to rest service and I want to cache data receive from server for further usage. Could anyone tell what is the best way to cash response?
7 You will find multiple answers here: Angular 2 cache observable http result data I would recommend to build simple class Cacheable<> that helps managing cache of data retrieved from http server or other any other source: declare type GetDataHandler<T> = () => Observable<T...
What are possible techniques to cache an Ajax response in Javascript? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 years ago. ...
7 This is specific for JQUERY.... Your can make ajax set up as cached. $.ajaxSetup({ cache: true}); and if for specific calls you don't want to make cached response then call $.ajax({ url: ..., type: "GET", cache: false, ......
Can I remove a single layer from from docker to prevent caching?
I have a long-running docker build process, so I would prefer not to disable caching for the entire build (with --no-cache). However, I would like to invalidate caching for a particular step. I had a bright idea: remove the cached layer and rebuild so this has to rebuild. I used: docker build --progress=plain to get ...
8 +150 Not directly possible. But can be done with some changes to your docker file. To forcibly break the cache, you can use "build-time arguments" (ARG); changing the value of that argument breaks the cache, and every step after it, for e...
NHibernate 2nd Level Cache Provider Differences
I've been using NHibernate for a while now, I'm still wondering what the differences are between the the Second Level Cache Providers ? Do some perform better\worse ? What is popular and why ? For clarity I'm talking about: NHibernate.Caches.MemCache NHibernate.Caches.Prevalence NHibernate.Caches.SharedCache NHiber...
Comparing these cache providers effectively boils down to comparing memcached vs prevalence vs Velocity, etc, and that is not really related to NHibernate. Here are some reasons (by no means a complete list) to pick one over the others: If you want to keep it simple and don't run your app in a farm, you might want to ...
Garbage-collected cache via Javascript WeakMaps
I want to cache large objects in JavaScript. These objects are retrieved by key, and it makes sense to cache them. But they won't fit in memory all at once, so I want them to be garbage collected if needed - the GC obviously knows better. It is pretty trivial to make such a cache using WeakReference or WeakValueDictio...
is it possible to make WeakReference from WeakMap or make garbage-collected cache from WeakMap ? AFAIK the answer is "no" to both questions.
Spark - StorageLevel (DISK_ONLY vs MEMORY_AND_DISK) and Out of memory Java heap space
Lately I've been running a memory-heavy spark job and started to wonder about storage levels of spark. I persisted one of my RDDs as it was used twice using StorageLevel.MEMORY_AND_DISK. I was getting OOM Java heap space during the job. Then, when I removed the persist completely, the job has managed to go through and...
7 So, after few years ;) that's what I believe happened: Caching is not a way to save execution memory. The best you can do is not to lose execution memory (DISK_ONLY) when caching. It's most likely the lack of execution memory that caused my job to throw OOM error, althou...
How to stop chrome from caching REST response from WebApi?
I am using ASP.NET WebApi and have the following code to stop caching in everything: public override System.Threading.Tasks.Task<HttpResponseMessage> ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext controllerContext, System.Threading.CancellationToken cancellationToken) { System.Threading.Tasks.Task...
The answer is that Chrome does not like "Expires:Mon, 01 Jan 0001 00:00:00 GMT" (a fake date, basically). I changed my date to be what they use in their Google API, and it worked: Cache-Control:no-store, must-revalidate, no-cache, max-age=0 Content-Length:1897 Content-Type:application/json; charset=utf-8 Date:Fri, 19 ...
Any Free Alternative to PostSharp [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Ove...
PostSharp Starter Edition is free and would meet your requirements.
Streaming audio file and caching it
I want to stream an audio mp3 file and then play it through android media player plus I also want to cache this file, so that mediaplayer don't have to stream for recently played tracks. I have tried using prepareAsync method but it doesn't give me access to buffer content, so I have decided to stream the audio file m...
0 The link you provided looks like a less than ideal solution (not to mention outdated). What you probably want is a local proxy server that gives you access to byte data before the MediaPlayer gets it. See my answer here for a little more explanation. Share Imp...
Force Cache-Control: no-cache in Chrome via XMLHttpRequest on F5 reload
I want to ensure that data I request via an AJAX call is fresh and not cached. Therefor I send the header Cache-Control: no-cache But my Chrome Version 33 overrides this header with Cache-Control: max-age=0 if the user presses F5. Example. Put a test.html on your webserver with the contents <script> var xhr = new ...
An alternative would be to append a unique number to the url. <script> var xhr = new XMLHttpRequest; xhr.open('GET', 'test.html?_=' + new Date().getTime()); //xhr.setRequestHeader('Cache-Control', 'no-cache'); xhr.send(); </script> timestamp isn't quite unique, but it should be unique enough for your ...
Is it possible to bundle / install gems from a local cache?
I have bunch of gems on my computer that I want to use in a chef recipe. I know it is possible to put them in a directory like /tmp/gems and just: cd /tmp/gems gem install *.gem Is it possible to put all gems in one directory where I can install them with bundler without downloading them again? cd /somedir/my_rails_...
You can add local directories to your Gemfile (example from the docs): gem "nokogiri", :path => "~/sw/gems/nokogiri" Alternatively, you can set up a local Git repository with the gems in it and write a Gemfile like this: gem "gem1", :git => "file:///tmp/gems", :branch => "gem1"
Can't connect to memcache
I am trying to connect to memcache as they suggest: $memcache = new Memcache(); $memcache->pconnect('localhost',11211); But i get: Notice: Memcache::pconnect() [memcache.pconnect]: Server localhost (tcp 11211) failed with: Connection refused (111) in /home/user/public_html/website.com/includes/basedatos.php on line 2...
You need to actually install the memcached server so that it can be connected to. On CentOS, this can be done with... sudo yum install memcached (on debian flavors of linux, use apt-get instead of yum)
How to clear complete cache in Varnish?
I'm looking for a way to clear the cache for all domains and all URLs in Varnish. Currently, I would need to issue individual commands for each URLs, for example: curl -X PURGE http://example.com/url1 curl -X PURGE http://example.com/url1 curl -X PURGE http://subdomain.example.com/ curl -X PURGE http://subdomain.examp...
With Varnish 4.0 I ended up implementing it with the ban command: sub vcl_recv { # ... # Command to clear complete cache for all URLs and all sub-domains # curl -X XCGFULLBAN http://example.com if (req.method == "XCGFULLBAN") { ban("req.http.host ~ .*"); return (synth(200, "Full cache ...
Disable Cache of okhttp
i know to disable cache of okhttp is to call Request.cacheControl(CacheControl.FORCE_NETWORK). Is it possible to set the cacheControl from OkHttpClient.class? Because i have 1 client for all my request. So i want to disable cache for all the request by disabling it from the okhttpClient
Use this to build Retrofit and provide cache as null the API will not cache anything. private OkHttpClient createOkHttpClient() { return new OkHttpClient.Builder() ... .cache(null) .build(); }
WordPress website still loading old style.css
I have made changes to style.css but the wordpress website is still showing old contents. I checked the file in FTP, and the changes in the file are there, but it's not showing on the website. I don't have any WP cache plugins. I also deleted cache in my browser and forces cache refresh through Ctrl+F5. :(
23 Try changing the version of the style.css file If included by giving the path in header then try to append version as <link style ........ href="...../style.css?v=1.5"... /> note the ?v=1.5 indicates the version if style.css is auto loaded then open your style.css file...
How do you clear image cache in iPhone 5S Safari browser?
Please forgive me if this question sounds like clearing Safari cache/cookies in General->Settings. The issue is as follows: We have a custom webpage where user can upload his profile icon/image by choosing from Phone's photo library or taking a photo. The 1st time user uploads an image P1, it's uploaded successfully ...
40 Launch the Settings app from the Home screen of your iPhone or iPad. Scroll down and tap on Safari. Now scroll all the way to the bottom and tap on Advanced. Tap on Website Data. Notice here you can see how much space on your iPhone or iPad website data is taking up. Sc...
Changing cache_dir and log_dir with Symfony2
Because of deployment constraints, I would like to have the log and cache directories used by my Symfony2 application somewhere under /var/... in my file system. For this reason, I am looking for a way to configure Symfony and to override the default location for these two directories. I have seen the kernel.cache_dir...
20 Add the following methods to app/AppKernel.php (AppKernel extends Kernel) making them return your preferred paths: public function getCacheDir() { return $this->rootDir . '/my_cache/' . $this->environment; } public function getLogDir() { return $this->rootDir . ...
Why does firefox not appear to be caching images? [closed]
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 10 years ago. Improve this question ...
Thanks kapep, good advice. Wasn't sure how to phrase as a question - but answering my own question I can do! First of all to ensure an image IS cacheable you must inspect the Response Headers to ensure the following headers are set to valid values: 'Cache-Control' is set to private or public. 'Expires' is a date in t...
In Java, how to convert a list of objects to byte array? [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: Converting any object to a byte array in java I have a class that needs to be cached. The cache API provides an interface that caches byte[]. My class contains ...
Author class should implement Serializable Then you can use ObjectOutputStream to serialize the object and ByteArrayOutputStream to get it written as bytes. Then deserialize it using ObjectInputStream and convert back. ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new Object...
How to make docker-compose pull new images?
I am using the latest tag in my Dockerfile in the FROM statement: # Dockerfile FROM registry.website.com/base-image:latest Every time my latest version changes I need to re-pull that image. Unfortunately, docker just takes the cached version. I tried docker-compose build --no-cache and docker-compose up --build --for...
26 I think you're looking for docker-compose pull: $ docker-compose help pull Pulls images for services defined in a Compose file, but does not start the containers. So docker-compose pull && docker-compose up should do what you want, without needing to constantly wipe you...
How to pass 'this' into a Promise without caching outside? [duplicate]
This question already has answers here: How to access the correct `this` inside a callback (15 answers) Closed 4 years ago. I have a variable called LangDataService.isDataReady tha...
LangDataService.isDataReady.then(function () { this.modalOn() }.bind(this));
IOS How do I asynchronously download and cache images and videos for use in my app
I have an iphone application that displays both images and videos. The way the app is structured most of the images and videos will remain the same, with one occasionally added. I would like an opinion on the best and easiest method for asynchronously downloading and caching both images and videos, so that they will p...
It is very simple to download and cache. The following code will asynchronously download and cache. NSCache *memoryCache; //assume there is a memoryCache for images or videos dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSString *urlString = @"http://URL"; NSData *dow...
How to Invalidate Web Browser Cache Content
I've been really digging into Google Page Speed, optimizing a lot of the sites I'm working on to score well on that -- and quite successfully I'm proud to say. The only downside I've come across is that by some of the caching stuff being done, small changes to JS and CSS tend not to cause a new copy of the files to do...
I'm running into similar issues sometimes that JS and CSS is cached to long. The solution that works for me is, adding an versionnumber or timestamp of the last update to the filename as querystring. This way the browser sees the file as changed and it will download it again. Could be something like this for getting J...
how to force vite clearing cache in vue3
I have a side project with Vue.js 3 and vite as my bundler. After each build the bundled files got the same hash from the build before, like: index.432c7f2f.js <-- the hash will be identical after each new build index.877e2b8d.css vendor.67f46a28.js so after each new build (with the same hash on the files) I had to...
I found a solution how to add a random hash with each file with the build process witch will clear the cache in the browser: // vite.config.js import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { hash } from './src/utils/functions.js' export default defineConfig({ plugins: [vue()], b...
Is it possible to cache Videos? IOS - Swift
I am trying to download and play videos in a tableView like Instagram, vine or even facebook. What I am trying to achieve is a tableView where I display the videos and they auto download and play while scrolling. Like Instagram... So far I have managed most of that, but what I would like to change is the fact that eve...
Using Haneke, I wasn't able to retrieve file path for cached video. I handled it by saving video in cached directory. public enum Result<T> { case success(T) case failure(NSError) } class CacheManager { static let shared = CacheManager() private let fileManager = FileManager.default private l...
How to use joblib.Memory of cache the output of a member function of a Python Class
I would like to cache the output of a member function of a class using joblib.Memory library. Here is a sample code: import joblib import numpy as np mem = joblib.Memory(cachedir='/tmp', verbose=1) @mem.cache def my_sum(x): return np.sum(x) class TestClass(object): def __init__(self): pass @m...
The following excerpt is taken from https://joblib.readthedocs.io/en/latest/memory.html#gotchas caching methods: you cannot decorate a method at class definition, because when the class is instantiated, the first argument (self) is bound, and no longer accessible to the Memory object. The following code won’t work: c...
Stop browser scripts caching in GWT App
I have a GWT app deployed onto our client's machines. As an ongoing development alongside, we have to release new improved versions of the application fron time to time. Everytime we release a new version we often run into the problem where the client's browser has cached the old scripts scriptsand for a while it beha...
By default, the bulk of your app should be cached by the browser until a new version of it is generated by your build process. It might help to understand the GWT bootstrapping model to understand how this works. The first script your client requests, your-app-name.nocache.js, is not cached, and it does nothing except...
304: Not modified and front end caching
I am using a PHP script to serve files. I would like to be able to send back a 304 not modified header in my http response if the file has not changed since the client last downloaded it. This seems to be a feature in Apache (and most other web servers), but I have no clue how this can be implemented through PHP. I h...
HTTP_IF_MODIFIED_SINCE is the right way to do it. If you aren't getting it, check that Apache has mod_expires and mod_headers enabled and working properly. Borrowed from a comment on PHP.net: $last_modified_time = filemtime($file); $etag = md5_file($file); // always send headers header("Last-Modified: ".gmdate("D, d ...
How to add an Expires response header to a WebAPI Action response?
I'm pretty sure that "Expires" is valid HTTP Response Header type. But when I try to set it in my code: (this is in an ActionFilter.OnActionExecuted method) actionExecutedContext.Response.Headers.Add("Expires", (DateTime.Now + Timespan.FromDays(7)).ToString("R")); I end up with an exception: InvalidOperationExceptio...
Expires is a content header. Try this instead: actionExecutedContext.Response.Content.Headers.Expires = DateTimeOffset.Now.AddDays(7);
Why does an imported css file get stored in localstorage and not refresh like a linked css file?
Files: listing.less (text/css) style.less (text/css) Tools: Firefox Firefox addon httpFox for inspecting http headers Chrome I have a css file named listing.less that contains the following: @import "/orb/static/less/style.less"; When I call listing.less everything works fine, style.less is imported. Subsequent r...
This is a known issue in LESS. See the github issue here: https://github.com/cloudhead/less.js/issues/47 I know it doesn't solve your problem directly, there is a workaround listed there, put the following line above your less.js import: <script type="text/javascript">var less=less||{};less.env='development';</script>...