I often use static entities to store labels, statuses and more.
In order to show them on screen, they are fetched from the server several times at different screens, sometimes all records to be selected in a filter, or sometimes one record to fetch attributes such as color, description etc.
Why fetch them so many times when they are static? A waste of server and database capacity and roundtrips.
In Mobile we have local storage entities to sync such data.
In Reactive we do not have access to local storage out of the box. There is a forge component (Local Storage) that allows us to store key-text value pairs.
I could use that to cache static entities as JSON. Not ideal but there are no server requests anymore.
But how do I know when to update the cache when the static entity is updated (or when a new client application is installed). Of course it can be updated on every OnApplicationReady but it would be better to update it only when the application is updated. How do I know when that happens? Should I check the Application manifest in the local storage?
Does anybody have a nice solution to cache static entities?
Hi @Rogier Olde Dubbelink ,
I think its good to use client variables in reactive application if data is,
Session-Specific Data:
Small Data Size:
Performance Optimization:
Non-Sensitive Information:
I hope it helps,
Thanks,
Jithu Thomas
Hi @Rogier Olde Dubbelink,
To efficiently cache static entities in Reactive applications, you can use a combination of local storage and versioning:
Cache Static Data: Use the Local Storage Forge component to store static entity data as JSON.
Track Application Updates: Save the application's version or a static entity timestamp in local storage.
Update Cache on Changes: Compare the stored version/timestamp with the current application version or a unique static entity identifier.
OnApplicationReady: If a mismatch is detected, fetch the latest data from the server and update the cache.
This ensures minimal server calls while keeping the cache updated.
Vipin Yadav
Thank you Vipin!
Then we are on the same page. Question remains:
How do I know determine the current application version?
Best regards,
Rogier
Please check the below link
https://www.outsystems.com/forums/discussion/74061/how-can-i-dynamically-get-the-version-number-of-my-application-to-show-inside-my/
I think we can use a Site Properties which can easily manage from service center and create logic accordingly to update the static entities in local storage.
There are couple of forge component for getting application version but bit complicated. I will prefer timestamp or Site Properties to track updates
https://www.outsystems.com/forge/component-overview/12301/application-version-information-o11