SimpleMetric Caching


SimpleMetric results can be cached so that the metric is evaluated only on first call. After that, every time the metric is evaluated, the result will be returned from the cache.

Here’s an example that configures caching for the last 4 months in the past for evaluations at day/month intervals.

    "id" : "SimpleMetricName_TypeName",
    "name" : "SimpleMetricName",
    "srcType" : "TypeName",
    "path" : ". . .",
    "expression" : ". . .",
    "description": ". . .",
    "cache":  {
        "intervals": ["DAY", "MONTH"],
        "monthsInPast": 4

When evaluating the metric, you need to set cache field of the EvalMetricSpec to true otherwise the metric will be re-evaluated and not served from the cache.

var evalResult = TypeName.evalMetric({
   cache: true

For more information on the cache specification c3ShowType(SimpleMetricCacheSpec)