Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document options.cache #370

Merged
merged 1 commit into from
Aug 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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