Skip to content

Commit

Permalink
docs: Document options.cache (#370)
Browse files Browse the repository at this point in the history
closes #351
  • Loading branch information
richdouglasevans authored and lance committed Aug 24, 2019
1 parent 4b33b28 commit 2684503
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,25 @@ <h3 class='fl m0' id='circuitbreaker'>



<tr>
<td class='break-word'><span class='code bold'>options.cache</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
</td>
<td class='break-word'><span>whether the return value of the first
successful execution of the circuit's function will be cached. Once a value
has been cached that value will be returned for every subsequent execution:
the cache can be cleared using
<code>clearCache</code>
. (The metrics
<code>cacheHit</code>
and

<code>cacheMiss</code>
reflect cache activity.) Default: false
</span></td>
</tr>



</tbody>
</table>

Expand Down
5 changes: 5 additions & 0 deletions docs/opossum.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ Constructs a [CircuitBreaker][1].
this function returns truthy, the circuit's failPure statistics will not be
incremented. This is useful, for example, when you don't want HTTP 404 to
trip the circuit, but still want to handle it as a failure case.
- `options.cache` **[boolean][50]** whether the return value of the first
successful execution of the circuit's function will be cached. Once a value
has been cached that value will be returned for every subsequent execution:
the cache can be cleared using `clearCache`. (The metrics `cacheHit` and
`cacheMiss` reflect cache activity.) Default: false

### close

Expand Down
6 changes: 6 additions & 0 deletions lib/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ Please use options.errorThresholdPercentage`;
* this function returns truthy, the circuit's failPure statistics will not be
* incremented. This is useful, for example, when you don't want HTTP 404 to
* trip the circuit, but still want to handle it as a failure case.
* @param {boolean} options.cache whether the return value of the first
* successful execution of the circuit's function will be cached. Once a value
* has been cached that value will be returned for every subsequent execution:
* the cache can be cleared using `clearCache`. (The metrics `cacheHit` and
* `cacheMiss` reflect cache activity.) Default: false
*
*
* @fires CircuitBreaker#halfOpen
* @fires CircuitBreaker#close
Expand Down

0 comments on commit 2684503

Please sign in to comment.