Class: Cache

system.process. Cache


new Cache(target, init)

Enqueue a collection of members definitions (commands) to apply or invoke with the specified target object.

Enqueue a collection of members definitions (commands) to apply or invoke with the specified target object.

Parameters:
Name Type Description
target Object

The object to map with this cache process.

init Array

The Array of Property to map in the target reference when the process is running.

See:
Example
var Cache = system.process.Cache ;

var object = {} ;

object.a = 1 ;
object.b = 2 ;
object.c = 3 ;
object.d = 4 ;

Object.defineProperties( object ,
{
    method1 :
    {
        value : function( value )
        {
            this.c = value ;
        }
    },
    method2 :
    {
        value : function( value1 , value2 )
        {
            this.d = value1 + value2 ;
        }
    }
});

trace( object ) ; // {a:1,b:2,c:3,d:4}

var cache = new Cache() ;

cache.addAttribute( "a" , 10 ) ;
cache.addAttribute( "b" , 20 ) ;

cache.addMethod( "method1" , 30 ) ;
cache.addMethodWithArguments( "method2" , [ 40 , 50 ] ) ;

cache.target = object ;

cache.run() ; // flush the cache and initialize the target or invoked this methods.

trace( object ) ; // {a:10,b:20,c:30,d:90}

Extends

Members


<constant> finishIt :system.signals.Signal

This signal emit when the action is finished.

Type:
Inherited From:

<readonly> length

Returns the number of properties.


<readonly> phase :string

Indicates the current phase.

Type:
  • string
Inherited From:
See:

<readonly> running :boolean

Indicates action is running.

Type:
  • boolean
Inherited From:

<constant> startIt :system.signals.Signal

This signal emit when the action is started.

Type:
Inherited From:

target :object

The target reference.

Type:
  • object

Methods


add(property)

Enqueues a specific Property definition.

Parameters:
Name Type Description
property system.data.Property

The property to register.

See:
Returns:

The current Cache reference.


addAttribute(name, value)

Enqueues an attribute name/value entry.

Parameters:
Name Type Description
name string

The name of the attribute to register.

value *

The value of the attribute to register.

Returns:

The current Cache reference.


addMethod(name, args)

Enqueues a method definition.

Parameters:
Name Type Description
name string

The name of the method to register.

args Array

The optional parameters to fill in the method.

Returns:

The current Cache reference.


addMethodWithArguments(name, args)

Enqueues a method definition.

Parameters:
Name Type Description
name string

The name of the method to register.

args Array

The optional parameters to fill in the method.

Returns:

The current Cache reference.


clear()

Removes all commands in memory.


clone()

Returns a shallow copy of this object.

Overrides:
Returns:

a shallow copy of this object.


isEmpty()

Indicates if the tracker cache is empty.


isLocked()

Returns true if the object is locked.

Inherited From:
Implements:
Returns:

true if the object is locked.


lock()

Locks the object.

Inherited From:
Implements:

notifyFinished()

Notify when the process is finished.

Inherited From:

notifyStarted()

Notify when the process is started.

Inherited From:

run()

Run the process.

Overrides:

unlock()

Unlocks the object.

Inherited From:
Implements: