Hello i’ve done a vaadin portlet but its giving constant answer to all users.
I want to cache Vaadin output , if someone requests portlet , it should give answer from answer whenever i want.
This can’t work easily. Read again the section on Vaadin architecture in the Book. Each user interface component you see on the browser produced a GWT class (javascript compiled from Java source) that is receiving UIDL instructions from a corresponding server-side Java class. The page is constructed in the browser, based on these instructions – Vaadin is not constructing HTML on the server that you could cache.
Well its true its not secure if it will be available automatically but as i written on top , @Cacheable annotation
It should be allowed developer to use it manually , but vaadin doesn’t support caching at all.
I don’t think its good to generate same request for all users , wasting cpu time much.
Unlike e.g. JSF, Vaadin is not a page based framework. Because of this, page caching just does not make sense. Please read the
architecture chapter .
Note that the UI structure of the portlet is not in the (very short) page sent as HTML but in a separate UIDL message requested by the client side engine once it has initialized itself. If your application is interactive in any way, the server side structure of the UI must be initialized for every session and the client has to request data specific to that session anyway. This is inherent in how frameworks like Vaadin work.
Anyway, what would you want to achieve with caching here?
If you want to do caching because you have tested that your application is too slow or consumes too much server side resources, most likely the best option would be to profile the application and just cache some internal data from the back-end with whichever mechanism is appropriate - the bottleneck is unlikely to be on the UI side.
If you have completely or almost completely static content and want to avoid the clients loading anything “extra” such as the widgetset (most parts of which are cached on the client after an initial load), Vaadin is probably not the best tool for your task.
Yes you are right.
So that means , for every page calls its better to use JSF instead of Vaadin.
For Ajax & WebSocket widget solution , vaadin better…
I was using Vaadin widget as a navigation bar that has no ajax at all.
On every page call from Liferay , footer was showing vaadin portlet.
But i’ll switch to JSF .
Its better for non ajax systems…
What do you think about cacheable button clicks or cachable events?
For example , instead of asking server same question , once get result if method if cacheable , so it will give result without sending anything to server?
I mean , decreasing AJAX calls , it will be good for vaadin to do it ?
Vaadin is a server based framework and I don’t see how this could be done generically with Vaadin.
However, it is certainly possible to create a custom widget for Vaadin which does cache things on the client side. There is even an add-on (
Snappy , status beta) that lets you move certain simple actions to the client side without writing custom client side code.