How can I cache objects in ASP.NET MVC?

You can still use the cache (shared among all responses) and session (unique per user) for storage. I like the following “try get from cache/create and store” pattern (c#-like pseudocode): public static class CacheExtensions { public static T GetOrStore<T>(this Cache cache, string key, Func<T> generator) { var result = cache[key]; if(result == null) { result … Read more

How to disable caching of single page application HTML file served through IIS?

Adding the following into web.config solution worked across Chrome, IE, Firefox, and Safari: <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <location path=”index.html”> <system.webServer> <httpProtocol> <customHeaders> <add name=”Cache-Control” value=”no-cache” /> </customHeaders> </httpProtocol> </system.webServer> </location> </configuration> This will ensure that the that Cache-Control header is set to no-cache when requesting index.html.

How to disable caching in Alamofire

You have a few options. Disabling the URLCache Completely let manager: Manager = { let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() configuration.URLCache = nil return Manager(configuration: configuration) }() Configuring the Request Cache Policy let manager: Manager = { let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() configuration.requestCachePolicy = .ReloadIgnoringLocalCacheData return Manager(configuration: configuration) }() Both approaches should do the trick for you. For … Read more

Do current x86 architectures support non-temporal loads (from “normal” memory)?

To answer specifically the headline question: Yes, recent1 mainstream Intel CPUs support non-temporal loads on normal 2 memory – but only “indirectly” via non-temporal prefetch instructions, rather than directly using non-temporal load instructions like movntdqa. This is in contrast to non-temporal stores where you can just use the corresponding non-temporal store instructions3 directly. The basic … Read more

How to properly invalidate an HTML5 Cache Manifest for online/offline web apps?

I think I’ve got this figured out: if there’s an error in one’s cache-manifest (say, a referenced file does not exist), then Firefox completely will stop processing anything applicationCache related. Meaning, it won’t update anything in your cache, including your cached cache-manifest. To uncover that this was the issue, I borrowed some code from Mozilla … Read more

Force IE8 *not* to use Compatibility View

In the absence of an X-UA-Compatible http-equiv header, the compatibility mode is determined by the !DOCTYPE (or the absence of a !DOCTYPE, as the case may be). For a chart of which !DOCTYPE gives you which mode (in various browsers) see here: http://hsivonen.iki.fi/doctype/ (You’ll need to scroll down toward the bottom of the page.) You … Read more

High performance serialization: Java vs Google Protocol Buffers vs …?

I haven’t compared Protocol Buffers with Java’s native serialization in terms of speed, but for interoperability Java’s native serialization is a serious no-no. It’s also not going to be as efficient in terms of space as Protocol Buffers in most cases. Of course, it’s somewhat more flexible in terms of what it can store, and … Read more

Pros/Cons of different ASP.NET Caching Options

Each Caching technology/methods have their own set of features. These features may seem to be of disadvantage in one application requirements but can be advantageous in other application requirements. So, in short , depending on your requirements decide which Caching technology and what features are best for you. For example, Let us discuss some client … Read more