My application receives data from the another server, using API with limited number of requests. Data changing rarely, but may be necessary even after refresh page.
Open the application. Settings Select the category. System -> Performance Type a number of minutes into the setting. Cache files (minutes) Save the settings.
The browser request caching is the oldest and most common type of client-side caching. It's built into the HTTP protocol standard. It lets the webmaster or developer control how often the browser requests a new copy of files from the server.
There are four main methods for storing large amounts of client-side data today: Web SQL, IndexedDB, Web Storage and Application Cache.
It consists of JavaScript APIs that allow you to store data on the client (i.e. on the user's machine) and then retrieve it when needed.
Server side web caching typically involves utilizing a web proxy which retains web responses from the web servers it sits in front of, effectively reducing their load and latency. Client side web caching can include browser based caching which retains a cached version of the previously visited web content.
As much as cross browser compatibility matters, cookie
is the only choice rather than web storage.
But the question really depends on what kind of data you are caching?
For what you are trying, cookie and web-storage might not be needed at all.
I would rather say, it would be stupid to cache the entire page as cookie or web-storage both. For these purposes, server-side caching options might be the better way.
Update:
Quoting:
data about user activity in some social networks (fb, vk, google+)
Detect the web-storage features, using libraries like mordernizr and if does not exists fall back to cookie method. A simple example
if (Modernizr.localstorage) {
// browser supports local storage
// Use this method
} else {
// browser doesn't support local storage
// Use Cookie Method
}
[1]: http://en.wikipedia.org/wiki/Web_storage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With