* 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)
| 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. |
no test coverage detected