caching

XMLHttpRequest: How to force caching?

强颜欢笑 提交于 2019-12-30 10:05:33
问题 I'm newer to XMLHttpRequests since I've previously used jQuery's AjAX method. However I need to work in a web worker and now I have to use the classic XMLHttpRequest for performance issues. I'm trying to rebuild the cache -property from jquery. If cache should be disabled I add this: xhr.setRequestHeader("Cache-Control", "no-cache"); But what header should I set if I want to force caching (not prevent)? 回答1: There are a variety of headers you can set to encourage caching, but they (including

What happens if the origin web server sets the expires value in response header as a time which is passed relatively long ago?

家住魔仙堡 提交于 2019-12-30 09:54:09
问题 What happens if the origin web server sets the expires value in response header as a time which is passed relatively long ago. For instance, consider current time is Fri, 25 Jan 2013 GMT, and the expire header is set as --> Expires: Thu, 01 Dec 1994 16:00:00 GMT How will the client respond for the above instance? Any help would be appreciated 回答1: Responding with a past date in the Expired header (earlier than the Date header value) makes no sense and would be a sign of some serious

Spring Security - No way to avoid cache-control

巧了我就是萌 提交于 2019-12-30 08:32:33
问题 I have an application and use a controller mapping of spring to load images to my users. (InputStream, response, etc). In my controller I set headers to cache-control, baseaded on files, etc. But there's always pragma: no-cache and Cache-Control:"max-age=0" inside all requests, and that's replace my response settings. I was trying everything to solve this, but nothing works. I already read all page and try everything I found about that: http://docs.spring.io/autorepo/docs/spring-security/3.2

Caching ASHX Image Response

女生的网名这么多〃 提交于 2019-12-30 07:05:35
问题 I have created an ashx file to generate image thumbnails on the fly. I would like to cache these images client side after they are called the first time. URL: ~/image.ashx?dir=user&w=25&h=25&force=yes&img=matt.jpg Code Behind: public void ProcessRequest (HttpContext context) { TimeSpan refresh = new TimeSpan(0, 15, 0); context.Response.Cache.SetExpires(DateTime.Now.Add(refresh)); context.Response.Cache.SetMaxAge(refresh); context.Response.Cache.SetCacheability(HttpCacheability.Server);

Caching $(this) in jQuery is a best practice?

半世苍凉 提交于 2019-12-30 06:38:28
问题 We all know it's good to cache calls to the DOM, so instead of calling $('#someElement') more times, just save it to a var $someElement and use that. But is it the same when using $(this) inside an event listener for example? Should $(this) be cached? Thank you. 回答1: Each time you call $(this) or $(selector) it is a function call to create a new jQuery object... so if you have already created it once, caching will save calling a function to create the same object again 回答2: If you call $(this

File Access Strategy in a Multi-Threaded Environment (Web App)

冷暖自知 提交于 2019-12-30 06:36:09
问题 I have a file which is an XML representation of some data that is taken from a Web service and cached locally within a Web Application. The idea being is that this data is very static, but just might change. So I have set it up to cache to a file, and stuck a monitor against it to check if it has been deleted. Once deleted, the file will be refreshed from its source and rebuilt. I am now running in to problems though, because obviously in a multi-threaded environment it falls over as it is

What is the meaning of the HTTP header Vary:*

混江龙づ霸主 提交于 2019-12-30 06:23:46
问题 As far as I know, the HTTP Header Vary specifies a comma separated list of HTTP headers that need to be considered by caches together with the URL when deciding if a request is a cache hit or miss. If that header is omitted, means that only the URL will be considered. But what happen when the header is Vary:* ? RFC 2616 14.4 A Vary field value of *** signals that unspecified parameters not limited to the request-headers (e.g., the network address of the client), play a role in the selection

ASP.NET can't cache null value

淺唱寂寞╮ 提交于 2019-12-30 05:48:07
问题 Can anyone explain why you cannot insert a null object into the ASP.NET cache? string exampleItem = null; HttpRuntime.Cache.Insert("EXAMPLE_KEY", exampleItem, Nothing, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration); The exception error message states that the "value" object cannot be null. In my application there are valid reasons why we whould want to store a null value in the cache. 回答1: Underlying Cache is likely a Hashtable or Dictionary<string, object> , whose

Is 5MB the de facto limit for W3C Web Storage?

风格不统一 提交于 2019-12-30 05:48:04
问题 I am looking into using browser sessionStorage for a web application, and was trying to find current information on size limitations. It appears most desktop browsers have imposed a 5MB limit. However, I am not finding many recent articles nor information on the mobile browsers. The Disk space of the W3C Web Storage specification says "A mostly arbitrary limit of five megabytes per origin is recommended. Implementation feedback is welcome and will be used to update this suggestion in the

HTML link that bypasses cache?

人走茶凉 提交于 2019-12-30 05:44:06
问题 I have a file that I link to from my website like <a href="http://example.com/myfile.txt>View!</a> However, this file changes very frequently and when the link is clicked, the browser loads the cached version of the file, not the actual file. Is there a way so that clicking on that link will bypass the cache for that page? Something nice like <a bypassCache href=""> would be wishful thinking. 回答1: Something nice like would be wishful thinking. Indeed, there is something you can do from within