html5-develoment

Create class interface with HTML5: Get Turbo charger up the Next Level with Browser Cache, Local Storage and the Application Cache

As per the computer technology, computer performance depends on cache a lot. Basically, caching is putting data anywhere when you get it the first time so access point become much more quickly the next time. As far as on web, we can grap good advantage of caching often to speed up users’ can check subsequent visit to site, keeping in mind that their next visit would be more frequent within next couple of second, when they ask for another page.

For mobile we want to make the best possible use of the caching. The main tool on the touch device is the normal browser cache, local storage and the application cache. Here we would see all the three things – Normal Browser Cache, which is not as good as it prefer to be, Local Storage, A newish API for persistent storage – incredible power full tool for manual cache and the Application Cache.

HTTP Caching

HTTP was designed with caching in mind. As per cache is concerned people are most familiar with browser cache, but other cache named the proxies often exist to user mouth. There are major three ways to control HTTP Cache:

• Validation
• Freshness
• Invalidation

Validation

Validation is known for the cache agent to determine the old cache is still good enough, without requesting the full resource. The server that sends a 304 Not Modified response and browser uses the file already in cache, rather than refetching from the server.

Other Validation is ETag known to be the unique identifier, usually hashes, which allow cache validation without dates by comparing a short string. Mean while requesting agent makes a conditional request. If the current content matches the client’s ETag, then the server can again return a 304 response.

Validating the cache does require a full round-trip to the server than better option would be download the file again, but avoiding a round trip altogether is preferable. That’s the reason for the far-future expiration date. If the cached item hasn’t expired, then the browser won’t attempt to validate it.

Freshness

Freshness is usually called with simplest name TTL (Time to Live). Using the headers, cache agents are informed how long to hold on a cache resource before it should be fetched again. The simplest way to handle is with Expiry header but one should remember YSlow and PageSpeed recommend setting far-future Expires headers for static content.
The main intent is browser will keep until it runs out of room in cache.

Invalidation

Browsers invalidate cached occurs after some actions, usually when any non-GET request to the same URL.

The result of this article is that what is purged is completely based on user behavior and there is no way to predict about its working. Assumption is if you don’t think about the cache headers, than some browsers will cache something that you are not willing to cache and not something you like to cache.