Page 1 of 1
Non-persistent data storage
Posted: Thu Apr 18, 2024 11:45 pm
by vitorhugovm
Is there a way to store and retrieve non-persistent data using the Java API?
Thanks!
Vitor
Re: Non-persistent data storage
Posted: Fri Apr 19, 2024 6:26 am
by Radu
Hi Vitor,
Our Java OptionsStorage API also persists the data when Oxygen is closed. Maybe you can create your own HashMap-like structure if you want to cache anything in a non persistent way.
Regards,
Radu
Re: Non-persistent data storage
Posted: Fri Apr 19, 2024 1:58 pm
by vitorhugovm
Hi Radu!
I found the class EditingSessionContext, which apparently solves the issue by setting and getting attributes with keys and values. Should I have any concern about the use of this class?
Thanks!
Vitor
Re: Non-persistent data storage
Posted: Fri Apr 19, 2024 4:04 pm
by cristi_talau
Hello,
EditingSessionContext lifetime is linked to a document that is opened in a browser tab. If you want to store data that is accessible for multiple documents, you may need another storage mechanism, for example a singleton class that holds key-value properties.
Best,
Cristian
Re: Non-persistent data storage
Posted: Tue Apr 23, 2024 9:01 pm
by vitorhugovm
Hello Cristian!
I'm currently using EditingSessionContext and it's doing exactly what I needed. The objective was to store and retrieve data only for the current document, this data must be erased if the document is reloaded or closed.
I'm using it to store external retrieved data that must not be inserted or contained in the XML, but needs to be used more than once for some purposes.
Thanks for the attention!
Vitor