Hi
I want to clear my CSPD upon closing my application from browser or from Right-Top-Corner Close button of title bar (in case of detached applet).
How to do that ?
I have two approaches. One is to specify "duration" flag in "persistent-data" settings. But it seems that the minimal duration unit is in days. I want to specify the duration as minutes/hours. And the second option will if there is a way to clear the CSPD forcefully upon applet close. How I can achieve this ?
Thank you.
As you have noted, the duration is in units of days, so it won't be useful for your purpose.
You should be able to clear the repository by calling methods directly on the Repository object. I believe something like this should work:
{define-proc {clear-repository}:void
def repository = {get-persistent-data-repository}
{repository.clear}
{repository.commit}
}
This is fine, but who will call "clear-repository" if user closes his browser directly ???
You can use {register-exit-proc clear-repository}, which will get called as long as the RTE does not crash - which would prevent the applet from executing this exit handler. An applet will eventually exit as long as the RTE does not crash first. I forget if non-IE browsers might keep applets alive even after their window is closed if the browser is still running (maybe other windows of the browser are still open) - something to think about. So if your users will be using non-IE browsers, you probably cannot count on having the applet exit soon enough if you want to restrict the persistent data duration to minutes or hours.
I think this question came up before in this forum, and the suggestion was that you should have a time stamp as part of your persistent data, and then when an applet starts or needs the data, the applet itself can clear the data if the data is too old. That would let you enforce shorter durations.
