Liferay Export & and Import Clear Liferay Cache


I was learning on how to implement the  export and import functionality on Liferay, initially I thought it to be rather a tedious job but thanks to Liferay API/Framework which made my job easier with Liferay Portlet Data Handlers thanks to Jorge Ferrer who gave me an insight to the API/Framework and how to use the same. All I was required to do is just create a class that extends from BasePortletDataHandler and have it configured via the liferay-portlet.xml
But this activity lead to an interesting learning, initially when I implemented this I saw that data was getting exported/imported without any errors but then I see that its not refreshing the UI immediately after the import. This kind of annoyed me for long time .. thanks to Raymond Auge for is timely insight that we need to clear the cache for the same to be refreshed.. so started my next task on hunting the class which can do the job..
The initial analysis started with me doing the manual task of clearing the caches via the Portal Control Panel using the Server Administration --> Resources (tab) --> Actions panel where we have the action buttons that will clear the cache held by Database, Virtual Machine both local and clustered...  when i did this sequence of actions after my Import, i see the data getting refreshed instantly..  so whats next ? finding out the class that did these jobs, when back tracing from the Server Admin page i landed up in the class EditServerAction, there I got the following three sweet little methods that can do the job for me,
  • CacheRegistryUtil.clear()  -  to clear all the Database caches
  • MultiVMPoolUtil.clear()    - clearing cache across JVM clusters
  • WebCachePoolUtil.clear() - clearing cache in Single VM
All left with me post this findings is that i need to call the required or all methods post my successful import of the data to clear the required caches...


https://www.liferay.com/web/kamesh.sampath/blog/-/blogs/how-to-clear-liferay-cache#gaco_message_26862842

Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate