Package | com.asfusion.mate.core |
Class | public class Cache |
Inheritance | Cache flash.utils.Proxy |
Implements | flash.events.IEventDispatcher, ISmartObject |
IActionList
.
Property | Defined by | ||
---|---|---|---|
generatorKey : Class
A key used as index to get the cached objects.
| Cache |
Property | Defined by | ||
---|---|---|---|
autoCreate : Boolean
Whether we create a new instance of the object when we don't find one in the cache.
| Cache | ||
cacheType : String
The cacheType property lets you specify whether we should use a local or cache.
| Cache | ||
chain : Array = null
A list of properties that has been accessed using the dot operator.
| Cache | ||
constructorArguments : Array
The constructorArgs allows you to pass an Array of objects to the contructor
when the instance is created.
| Cache | ||
registerTarget : Boolean
Registers the newly created object as an injector target.
| Cache |
Method | Defined by | ||
---|---|---|---|
Cache(key:Class, cacheType:String, autoCreate:Boolean = false, registerTarget:Boolean = false, constructorArguments:Array = null)
Constructor
| Cache | ||
addCachedInstance(key:*, instance:Object, type:String, scope:IScope):void
[static]
Stores an instance in the cache.
| Cache | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, weakRef:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
| Cache | ||
addKey(chain:Array, key:String):void
| Cache | ||
clearCachedInstance(key:*, type:String, scope:IScope):*
[static]
Removes an instance from the cache.
| Cache | ||
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
| Cache | ||
getCachedInstance(key:*, type:String, scope:IScope):Object
[static]
Get an instance from the cache.
| Cache | ||
This method returns the real value of the
SmartObject
| Cache | ||
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
| Cache | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
| Cache | ||
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object
or any of its ancestors for the specified event type.
| Cache |
Method | Defined by | ||
---|---|---|---|
getProperty(name:*):*
Overrides any request for a property's value.
| Cache |
Constant | Defined by | ||
---|---|---|---|
GLOBAL : String = "global" [static] Global cache
| Cache | ||
INHERIT : String = "inherit" [static] Use same cache type that is defined in the EventMap.
| Cache | ||
LOCAL : String = "local" [static] Local cache, it is the one that lives in the EventMap
| Cache | ||
NONE : String = "none" [static] Does not use cache.
| Cache |
autoCreate | property |
protected var autoCreate:Boolean
Whether we create a new instance of the object when we don't find one in the cache.
cacheType | property |
protected var cacheType:String
The cacheType property lets you specify whether we should use a local or cache.
chain | property |
protected var chain:Array = null
A list of properties that has been accessed using the dot operator. For example, if you a access an inner property like this: myObject.property1.property2, the chain is equivalent to an array with 2 items [property1,property2]
constructorArguments | property |
protected var constructorArguments:Array
The constructorArgs allows you to pass an Array of objects to the contructor when the instance is created.
generatorKey | property |
generatorKey:Class
[read-write]A key used as index to get the cached objects. The Class name is the key used to cach objects.
This property can be used as the source for data binding.
Implementation public function get generatorKey():Class
public function set generatorKey(value:Class):void
registerTarget | property |
protected var registerTarget:Boolean
Registers the newly created object as an injector target. If true, this allows this object to be injected
with properties using the Injectors
tags.
Cache | () | constructor |
public function Cache(key:Class, cacheType:String, autoCreate:Boolean = false, registerTarget:Boolean = false, constructorArguments:Array = null)
Constructor
Parameterskey:Class |
|
cacheType:String |
|
autoCreate:Boolean (default = false )
|
|
registerTarget:Boolean (default = false )
|
|
constructorArguments:Array (default = null )
|
addCachedInstance | () | method |
public static function addCachedInstance(key:*, instance:Object, type:String, scope:IScope):void
Stores an instance in the cache. The cache can be local, global or inherit. The key that we use to store the instance is the class of the object that we want to store.
Parameterskey:* |
|
instance:Object |
|
type:String |
|
scope:IScope |
addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, weakRef:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false )
|
|
priority:int (default = 0 )
|
|
weakRef:Boolean (default = false )
|
addKey | () | method |
public function addKey(chain:Array, key:String):void
Parameters
chain:Array |
|
key:String |
clearCachedInstance | () | method |
public static function clearCachedInstance(key:*, type:String, scope:IScope):*
Removes an instance from the cache. The cache can be local, global or inherit. The key used is the class of the object that we want to removed.
Parameterskey:* |
|
type:String |
|
scope:IScope |
* |
dispatchEvent | () | method |
public function dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent() is called.
Parametersevent:Event |
Boolean |
getCachedInstance | () | method |
public static function getCachedInstance(key:*, type:String, scope:IScope):Object
Get an instance from the cache. The cache can be local, global or inherit. The key used is the class of the object that we want to access.
Parameterskey:* |
|
type:String |
|
scope:IScope |
Object |
getProperty | () | method |
flash_proxy override function getProperty(name:*):*
Overrides any request for a property's value. If the property can't be found, the method returns undefined. For more information on this behavior, see the ECMA-262 Language Specification, 3rd Edition, section 8.6.2.1.
Parametersname:* |
* |
getValue | () | method |
public function getValue(scope:IScope, debugCall:Boolean = false):Object
This method returns the real value of the SmartObject
scope:IScope |
|
debugCall:Boolean (default = false )
|
Object |
hasEventListener | () | method |
public function hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
This allows you to determine where an EventDispatcher object has altered handling of an event type
in the event flow hierarchy. To determine whether a specific event type will actually trigger an
event listener, use IEventDispatcher.willTrigger()
.
The difference between hasEventListener()
and willTrigger()
is that hasEventListener()
examines only the object to which it belongs, whereas willTrigger()
examines the entire event
flow for the event specified by the type parameter.
type:String |
Boolean |
removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false )
|
willTrigger | () | method |
public function willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. This method returns true if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.
The difference between hasEventListener()
and willTrigger()
is that hasEventListener()
examines only the object to which it belongs, whereas willTrigger()
examines the entire event
flow for the event specified by the type parameter.
type:String |
Boolean |
GLOBAL | constant |
public static const GLOBAL:String = "global"
Global cache
INHERIT | constant |
public static const INHERIT:String = "inherit"
Use same cache type that is defined in the EventMap. Can be either local or global
LOCAL | constant |
public static const LOCAL:String = "local"
Local cache, it is the one that lives in the EventMap
NONE | constant |
public static const NONE:String = "none"
Does not use cache.