spark.managers

# PersistenceManager - AS3 Flex

Package | spark.managers
Class | public class PersistenceManager
Inheritance | PersistenceManager Object
Implements | IPersistenceManager

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

The PersistenceManager class is a basic persistence manager that is backed by a local shared object named FxAppCache. When initialized, it loads a local shared object that matches its id. If a local shared object is not found, it is created.

When storing values using the manager, it is important that all values can be properly be written to a shared object. Complex objects that store classes or non-standard flash primitives must implement flash.net.IExternalizable interface to work properly. Saving incompatible objects does not cause an RTE, but creates undefined behavior when the data is read back.

Related API Elements

flash.utils.IExternalizable

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | PersistenceManager() Constructor. | PersistenceManager
|  | clear():void Clears all the data that is being stored by the persistence manager. | PersistenceManager
|  | getProperty(key:String):Object Returns the value of a property stored in the persistence manager. | PersistenceManager
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | load():Boolean Initializes the persistence manager. | PersistenceManager
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | save():Boolean Flushes the data being managed by the persistence manager to disk, or to another external storage file. | PersistenceManager
|  | setProperty(key:String, value:Object):void Stores a value in the persistence manager. | PersistenceManager
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Constructor Detail

### PersistenceManager

()
Constructor

`public function PersistenceManager()`

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

Constructor.

Method Detail

### clear

()
method

`public function clear():void`

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

Clears all the data that is being stored by the persistence manager.

### getProperty

()
method

`public function getProperty(key:String):Object`

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

Returns the value of a property stored in the persistence manager. Properties are saved as key:value pairs.

Parameters

| `key:String` — The property key.

Returns

| `Object` — The value of a property stored in the persistence manager.

### load

()
method

`public function load():Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

Initializes the persistence manager.

Returns

| `Boolean` — `true` if the operation is successful.

### save

()
method

`public function save():Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

Flushes the data being managed by the persistence manager to disk, or to another external storage file.

Returns

| `Boolean` — `true` if the operation is successful.

### setProperty

()
method

`public function setProperty(key:String, value:Object):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 4.5

Runtime Versions: | AIR 2.5

Stores a value in the persistence manager. Properties are saved as key:value pairs.

Parameters

| `key:String` — The key to use to store the value.
| `value:Object` — The value object to store.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00