Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client side caching in GWT

Tags:

java

caching

gwt

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?

like image 754
Silfverstrom Avatar asked Mar 02 '10 11:03

Silfverstrom


People also ask

What is client side caching?

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.

Is caching server side or client side?

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.

How do I clear the GWT cache?

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 cache stored client side?

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.


1 Answers

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.

like image 79
Robert Munteanu Avatar answered Oct 25 '22 01:10

Robert Munteanu