PersistentValue

PersistentValue["name"]

represents the persistent value associated with the key "name".

PersistentValue["name",loc]

represents the persistent value associated with name stored in persistence location loc.

PersistentValue["name",{loc1,}]

represents the persistent value associated with name at the first of the locations loci at which it occurs.

Details and Options

Examples

open allclose all

Basic Examples  (3)

Assign a persistent value:

In[1]:=
Click for copyable input
Out[1]=

Retrieve a previously saved value:

In[2]:=
Click for copyable input
Out[2]=

Remember a value with front end session scope:

In[1]:=
Click for copyable input

Use the saved value, even in a newly restarted kernel within the same front end session:

In[2]:=
Click for copyable input

Store values for the same name at different persistence locations:

In[1]:=
Click for copyable input

Retrieve the first value found:

In[2]:=
Click for copyable input
Out[2]=

Retrieve the list of all values on $PersistencePath:

In[3]:=
Click for copyable input
Out[3]=

Options  (7)

Applications  (1)

Properties & Relations  (4)

See Also

PersistentObject  PersistenceLocation  $PersistencePath  $PersistenceBase  PersistentObjects

Introduced in 2017
(11.1)