Packagelaya.utils
Classpublic class WeakObject
InheritanceWeakObject Inheritance Object

封装弱引用WeakMap 如果支持WeakMap,则使用WeakMap,如果不支持,则用Object代替 注意:如果采用Object,为了防止内存泄漏,则采用定时清理缓存策略



Public Properties
 PropertyDefined By
  delInterval : int
[static] 如果不支持WeakMap,则多少时间清理一次缓存,默认10分钟清理一次
WeakObject
  I : WeakObject
[static] 全局WeakObject单例
WeakObject
  supportWeakMap : Boolean
[static] 是否支持WeakMap
WeakObject
Public Methods
 MethodDefined By
  
WeakObject
  
clearCache():void
[static] 清理缓存,回收内存
WeakObject
  
del(key:Object):void
删除缓存
WeakObject
  
get(key:Object):*
获取缓存
WeakObject
  
has(key:Object):Boolean
是否有缓存
WeakObject
  
set(key:Object, value:Object):void
设置缓存
WeakObject
Property Detail
delIntervalproperty
public static var delInterval:int

如果不支持WeakMap,则多少时间清理一次缓存,默认10分钟清理一次

Iproperty 
public static var I:WeakObject

全局WeakObject单例

supportWeakMapproperty 
public static var supportWeakMap:Boolean

是否支持WeakMap

Constructor Detail
WeakObject()Constructor
public function WeakObject()



Method Detail
clearCache()method
public static function clearCache():void

清理缓存,回收内存

del()method 
public function del(key:Object):void

删除缓存

Parameters

key:Object

get()method 
public function get(key:Object):*

获取缓存

Parameters

key:Object — kye对象,可被回收

Returns
*
has()method 
public function has(key:Object):Boolean

是否有缓存

Parameters

key:Object

Returns
Boolean
set()method 
public function set(key:Object, value:Object):void

设置缓存

Parameters

key:Object — kye对象,可被回收
 
value:Object — object对象,可被回收