MCPcopy
hub / github.com/CacheControl/json-rules-engine / _setFactValue

Method _setFactValue

src/almanac.js:85–92  ·  view source on GitHub ↗

* Sets the computed value of a fact * @param {Fact} fact * @param {Object} params - values for differentiating this fact value from others, used for cache key * @param {Mixed} value - computed value

(fact, params, value)

Source from the content-addressed store, hash-verified

83 * @param {Mixed} value - computed value
84 */
85 _setFactValue (fact, params, value) {
86 const cacheKey = fact.getCacheKey(params)
87 const factValue = Promise.resolve(value)
88 if (cacheKey) {
89 this.factResultsCache.set(cacheKey, factValue)
90 }
91 return factValue
92 }
93
94 /**
95 * Add a fact definition to the engine. Facts are called by rules as they are evaluated.

Callers 4

_addConstantFactMethod · 0.95
addFactMethod · 0.95
factValueMethod · 0.95
almanac.test.jsFile · 0.80

Calls 1

getCacheKeyMethod · 0.80

Tested by

no test coverage detected