Class: KmlElementsFactoryCached

KmlElementsFactoryCached()

new KmlElementsFactoryCached()

More complex factory, which retrieves the values from cache and in case the value isn't present there it stores the value in cache.
Source:

Methods

(static) applicationWide() → {KmlElementsFactoryCached}

It returns application wide instance of the factory.
Source:
Returns:
Singleton instance of factory for Application.
Type
KmlElementsFactoryCached

all(element) → {Array.<KmlObject>}

It adds caching functionality on top of the KmlElementsFactory all method.
Parameters:
Name Type Description
element KmlObject Element whose children are considered
Source:
See:
  • KmlElementsFactory.prototype.all
Returns:
All objects among the elements children
Type
Array.<KmlObject>

any(element, options) → {KmlObject|null}

It adds caching functionality on top of the KmlElementsFactory any method.
Parameters:
Name Type Description
element KmlObject Element whose children are considered
options Object
Properties
Name Type Description
name Array.<String> Array of the names among which should be the one we are looking for.
Source:
See:
  • KmlElementsFactory.prototype.any
Returns:
KmlObject if there is one with the passed in name.
Type
KmlObject | null

cacheKey(node, prefix) → {String}

It creates cache key based on the node. In case the node doesn't have any id, it also creates id for this element. This id is used for storing the value in the cache.
Parameters:
Name Type Description
node Node Node for which generate the key.
prefix String | undefined Prefix for the level
Source:
Returns:
Value representing the key.
Type
String

specific(element, options)

It adds caching functionality on top of the KmlElementsFactory specific method.
Parameters:
Name Type Description
element KmlObject Element whose children are considered
options Object
Properties
Name Type Description
name String Name of the element to retrieve from the element
transformer function Function returning correct value. It accepts the node and returns value. This mechanism can be used for the attributes as well.
Source:
See:
  • KmlElementsFactory.prototype.specific
Returns:
Relevant value.