Wolfram Language & System 12.1 (2020)|Legacy Documentation
This is documentation for an earlier version of Wolfram Language.View current documentation (Version 14.3)
PersistentObject
PersistentObject["name",loc]
represents a persistent object stored at persistence location loc.
Details


- PersistentObject["name",loc]["meta"]=val sets the metadata element "meta" to val.
- The following metadata elements can be given:
-
"Value" Null the value of the persistent object itself "HeldValue" Hold[Null] the value wrapped in Hold "MergingFunction" Automatic the default merging function to use "ValuePreprocessingFunction" Identity the function applied to new values to be assigned "ModificationDate" None time stamp of last modification "ExpirationDate" None time after which data is no longer used "Creator" $Username user who last modified the object - PersistentObject["name",loc][All] gives the association of all metadata.
- PersistentObject["name",loc]["Name"] gives "name", and PersistentObject["name",loc]["Location"] gives loc.
- DeleteObject[PersistentObject[…]] removes a persistent object from the specified location.
- In PersistentObject["name",loc], possible forms for the persistence location loc include:
-
PersistenceLocation["type"] "Local", "Cloud", etc. locations "type" equivalent to PersistenceLocation["type"] PersistenceLocation["type","base"] location with a particular base (directory etc.) "type""base" equivalent to PersistenceLocation["type","base"] - Supported location types include:
-
"KernelSession" current invocation of the Wolfram Language kernel "FrontEndSession" current invocation of the Wolfram Notebook front end "Notebook" the notebook in which the current evaluation is being done "ServerSession" persistence for requests on a single web server "CookieManaged" persistence based on a Wolfram browser cookie "Local" local to a computer, based on user home directory "LocalShared" local to a computer, based on $BaseDirectory "Cloud" in the cloud defined by the current $CloudBase "Installation" installation defaults
Examples
open allclose allBasic Examples (2)
Create a persistent object by assigning it a value:
Give all metadata of the object:
Remove all persistent objects with a given key on $PersistencePath:
Scope (1)
Properties & Relations (3)
Possible Issues (1)
Applying PersistentObject itself does not create an actual object; it only refers to an object. So accessing its elements will return an error:
Only by setting one of its meta elements is it actually created:
Delete a persistent object with DeleteObject:
Introduced in 2017
(11.1)
|
Updated in 2017 (11.2)
2019 (12.0)
2020 (12.1)