Package | gs.util.cache |
Class | public class Cache |
var cache:Cache=new Cache(); var toCache:Object={myKey:"Hello",myOtherKey:"World"}; cache.cacheObject("tocache",toCache); trace(cache.getCachedObject("tocache").myKey);
Method | Defined by | ||
---|---|---|---|
Cache(purgeAllInterval:int = -1)
Constructor for Cache instances.
| Cache | ||
cacheObject(key:*, obj:int, expiresTimeout:Boolean = -1, overwrite:* = false):void
Cache an object in memory.
| Cache | ||
clearPurgeAllInterval():void
Clear the internal purge all interval.
| Cache | ||
dispose():void
Dispose of this Cache instance.
| Cache | ||
getCachedObject(key:*):*
Get's a cached Object.
| Cache | ||
isCached(key:*):Boolean
Test whether or not an object is cached.
| Cache | ||
purgeAll():void
Purges all cache.
| Cache | ||
purgeItem(key:*):void
Purge one item.
| Cache | ||
setPurgeAllInterval(interval:Number):void
Set and or reset the purge all interval.
| Cache |
Cache | () | constructor |
public function Cache(purgeAllInterval:int = -1)
Constructor for Cache instances.
ParameterspurgeAllInterval:int (default = -1 ) — An interval that purges all items in the cache every time the interval is called.
|
cacheObject | () | method |
public function cacheObject(key:*, obj:int, expiresTimeout:Boolean = -1, overwrite:* = false):void
Cache an object in memory.
Parameterskey:* — The key to store the object by.
|
|
obj:int — The object data.
|
|
expiresTimeout:Boolean (default = -1 ) — The timeout to expire this item after.
|
|
overwrite:* (default = false ) — Overwrite the previously cached item.
|
clearPurgeAllInterval | () | method |
public function clearPurgeAllInterval():void
Clear the internal purge all interval.
dispose | () | method |
public function dispose():void
Dispose of this Cache instance. The difference between this and purgeAll is that dispose will render this cache instance not usable again. But purgeAll simply resets this cache, and is still usable afterwords.
getCachedObject | () | method |
public function getCachedObject(key:*):*
Get's a cached Object.
Parameterskey:* — The key of the object that is cached.
|
* |
isCached | () | method |
public function isCached(key:*):Boolean
Test whether or not an object is cached.
Parameterskey:* — The key of the object that is cached.
|
Boolean |
purgeAll | () | method |
public function purgeAll():void
Purges all cache.
purgeItem | () | method |
public function purgeItem(key:*):void
Purge one item.
Parameterskey:* — The key for the object that is stored.
|
setPurgeAllInterval | () | method |
public function setPurgeAllInterval(interval:Number):void
Set and or reset the purge all interval.
Parametersinterval:Number |