We have a gwt-client, which recieves quite a lot of data from our servers. Logically, i want to cache the data on the client side, sparing the server from unnecessary requests.
As of today i have let it up to my models to handle the caching of data, which doesn't scale very well. It's also become a problem since different developers in our team develop their own "caching" functionality, which floods the project with duplications.
I'm thinking about how one could implement a "single point of entry", that handles all the caching, leaving the models clueless about how the caching is handled.
Does anyone have any experience with client side caching in GWT? Is there a standard approach that can be implemented?
Client-side caching duplicates the data of previously requested files directly within browser applications or other clients (such as intermediate network caches). Client cache is the most efficient type of caching, because it allows browsers to access files without communicating with the web server.
The main difference between Server-side Caching and Client-side Caching is the location of stored data. In Server-side Caching, the data is in the server for many users, while in Client-side Caching, the information is in the user's local system.
One solution is to implement a servlet filter that adds the necessary HTTP-headers that control the caching behaviour. Date should be set to the time of the request. Expires is best set to sometime in the past, this forces everyone to consider the content already stale.
Is it client side or server side? It can be either, or both. Server side caches are generally used to avoid making expensive database operations repeatedly to serve up the same content to lots of different clients.
I suggest you look into gwt-presenter and the CachingDispatchAsync
. It provides a single point of entry for executing remote commands and therefore a perfect opportunity for caching.
A recent blog post outlines a possible approach.
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