|
Data in the client persistent data repository is keyed to the Url of
the persistent data identifier.
In the default, unshared, case, the persistent data identifier is the
Url of the applet, and no other unprivileged applet can access that
persistent data.
By making the Url of the persistent data identifier different than the
Url of the applet, it can be shared between applets. Do this by
creating a file containing only a persistent-data curly expression.
(In the default case, the persistent-data curly expression appears in
the applet. Here we are putting it into an external file.) Then in
each applet use a get-persistent-data-repository call to get the
shared repository, and then use get-persistent-data and
set-persistent-data, passing them the repository, to access the data.
Create a file that looks like this:
{persistent-data
"This persistent data is for the Super Excellent
Curl Applets",
}
In the applets, create a reference to the Repository:
let r:Repository =
{get-persistent-data-repository pdi-name="name of
file containing persistent-data curly expression"}
Then use the repository keyword parameter in get-persistent-data and
set-persistent-data to reference the Repository:
{set-persistent-data, key, value, repository=r}
Please note that the client-side persistent data mechanism
does not currently have the synchronization support that would be
required for sharing data
between two applets that could be running at the same time,
though the mechanism works fine for sharing information between different
applets that are executed at different times
on the same client machine.
An additional point:
An applet can reference multiple shared persistent data repositories.
|