Liking cljdoc? Tell your friends :D

vaelii.impl.call-cap

Per-KB counts of named expensive calls, each name with the most calls one KB may take. While count! counts, counted adds one to the KB's count for its name, unless a call under that name running on this thread has counted. allow raises one KB's limit under a name and records why, and entries lists the counts with any allowance. A KB is keyed by object identity and held weakly. With counting off, counted costs one atom read. To guard a call, declare its name once as (def name (call-cap/capped ::name n)) and wrap each call site as (call-cap/counted name kb #(...)).

Per-KB counts of named expensive calls, each name with the most calls one KB may take.
While `count!` counts, `counted` adds one to the KB's count for its name, unless a call
under that name running on this thread has counted.  `allow` raises one KB's limit under
a name and records why, and `entries` lists the counts with any allowance.  A KB is keyed
by object identity and held weakly.  With counting off, `counted` costs one atom read.
To guard a call, declare its name once as `(def name (call-cap/capped ::name n))` and
wrap each call site as `(call-cap/counted name kb #(...))`.
raw docstring

allowclj

(allow name kb n reason)

While counting, let kb take up to n calls under name in place of name's cap, reason saying why it takes them.

While counting, let `kb` take up to `n` calls under `name` in place of `name`'s cap,
`reason` saying why it takes them.
sourceraw docstring

cappedclj

(capped name cap)

Declare name with cap, the most counted calls under name one KB may take, and return name.

Declare `name` with `cap`, the most `counted` calls under `name` one KB may take, and
return `name`.
sourceraw docstring

count!clj

(count!)
(count! tag)

Count from zero, tag naming a KB's caller at its first counted call under a name, or stop counting with no argument.

Count from zero, `tag` naming a KB's caller at its first counted call under a name, or
stop counting with no argument.
sourceraw docstring

countedclj

(counted name kb f)

Run (f) as one call under name on kb: while counting, add one to kb's count for name, unless a call under name running on this thread has counted.

Run `(f)` as one call under `name` on `kb`: while counting, add one to `kb`'s count for
`name`, unless a call under `name` running on this thread has counted.
sourceraw docstring

entriesclj

(entries)

Each count as {:name n :kb k :tag t :count c :cap m}: k names the KB by its identity hash, t is the count! tag's value at its first call or allowance, and m is n's cap. An entry given an allow also holds :allow and :reason.

Each count as `{:name n :kb k :tag t :count c :cap m}`: `k` names the KB by its identity
hash, `t` is the `count!` tag's value at its first call or allowance, and `m` is `n`'s
cap.  An entry given an `allow` also holds `:allow` and `:reason`.
sourceraw docstring

scopeclj

(scope name f)

Run (f) as at most one call under name: the first counted call under name that f runs counts, and the rest count nothing.

Run `(f)` as at most one call under `name`: the first `counted` call under `name` that
`f` runs counts, and the rest count nothing.
sourceraw docstring

uncountedclj

(uncounted name f)

Run (f) with no count under name, as part of a call counted where it began.

Run `(f)` with no count under `name`, as part of a call counted where it began.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close