Using Caches for Enrichment --------------------------- You can configure a literal cache or an external cache as a lookup table to populate attributes based on an id in the data. This is useful for enriching records with static information from an external source. In the example below, we use the ``cacheLookup`` function to resolve the name of a person based on the ``number`` in each record. Each cache can be configured to expire records based on an ``expiration`` parameter in milliseconds. Config: :: { type = "xml" id-field = "uuid()" feature-path = "Feature" // optional path to feature elements options = { line-mode = "multi" // or "single" } caches = { names = { type = "simple" data = { 123 = { name = "Jane" email = "bar@baz.com" } 148 = { name = "Mary" email = "foo@bar.com" } } } } fields = [ { name = "number", path = "number", transform = "$0::integer" } { name = "color", path = "color", transform = "trim($0)" } { name = "weight", path = "physical/@weight", transform = "$0::double" } { name = "source", path = "/doc/DataSource/name/text()" } { name = "lat", path = "geom/lat", transform = "$0::double" } { name = "lon", path = "geom/lon", transform = "$0::double" } { name = "name", transform = "cacheLookup('names', $number, 'name')" } { name = "geom", transform = "point($lon, $lat)" } ] } Data: .. code-block:: xml myxml 123 12.23 44.3 red 456 20.3 33.2 blue To configure a Redis cache, specify the ``caches`` section as follows: Config: :: { caches = { redis = { type = "redis" redis-url = "url_of_redis" expiration = 30000 // milliseconds } } }