XOTcl - Documentation -- xotcl/library/store/Persistence.xotcl

xotcl/library/store/Persistence.xotcl xotcl/library/store/Persistence.xotcl

Package/File Information

No package provided/required

Defined Objects/Classes:
Filename: xotcl/library/store/Persistence.xotcl

Description: Persistent store for XOTcl objects with Eager and Lazy persistence. Take a look at "persistenceExample.xotcl" for exmaple of usage.

Class: PersistenceMgr

Class: Class
Description: A persistent store requires a persistent manager. The persistent manager implements the Storage interface via storage mixin. With the parameter "dbPackage" we can specify which storage will be used. The persistent manager than tries to load the package "xotcl::${dbPackage}Storage". Default is Sdbm. Example:
        PersistenceMgr pmgr -persistenceDir . -persistenceFile example-db

Class: Persistent

Class: Class
Procs/Instprocs: makeVarScript, persistenceMgr, persistent, persistent+init, persistentVars, unPersistent.
Description: Superclass or mixin class for all persistent objects. Normally subclasses are used as mixins or instmixins on object, like:
        o mixin Persistent=Eager
        p mixin Persistent=Lazy


  • persistenceMgr args
    Arguments: args: persistent manager name
    Description: Specify which persistence manager to use for [self] object, like:
            o persistenceMgr pmgr
    Each persistent object must have a persistence manager specified, before vars can be made persistent.
  • persistentVars
    Description: Returns list of persistent vars.
  • persistent list
    Arguments: list: persistent variables
    Description: Make a list of object variables persistent. If a persistent DB exists, the values are read from this DB, overwriting the current value. E.g.:
            o persistent {x y}
  • persistent+init list
    Arguments: list: persistent variables
    Description: Initialize all data in the list as empty strings, if they do not exist yet, and then make them persistent using the 'persistent' method
  • unPersistent list
    Arguments: list: persistent variables
    Description: Make a list of object variables not persistent.
  • makeVarScript
    Description: Build a Tcl script of "set ..." statements reflecting the current situation in the database.

Class: Persistent=Eager

Class: Class
Description: Eager persistence strategy. Store everything at the same moment to the database

Class: Persistent=Lazy

Class: Class
Description: Lazy persistence strategy. Store everything on object destroy (or program termination).

Back to index page.