Skip to content

docs: correct stale Cachex API examples - #441

Open
dajiaohuang wants to merge 1 commit into
whitfin:mainfrom
dajiaohuang:docs/fix-stale-v4-examples
Open

dajiaohuang wants to merge 1 commit into
whitfin:mainfrom
dajiaohuang:docs/fix-stale-v4-examples

Conversation

@dajiaohuang

Copy link
Copy Markdown

Correct documentation examples that no longer match Cachex's existing return values and entry record order. decr returns the integer directly, get returns the value or nil, put returns :ok, entry tuples place value before timestamps, and router children/2 returns a list of child specs. No runtime code or behavior changes.

Fixes #440. The proposal was raised there before this PR. This is the upstream submission of the unchanged documentation branch previously available in the fork.

Validation on Elixir 1.19.6: format, Credo, documentation generation, and overview drift checks passed. The complete suite contains 217 tests; two existing timestamp assertions with a 10 ms tolerance failed under machine load and passed when rerun. The documentation changes do not touch those assertions or runtime behavior. Current-head upstream CI remains pending.

- decr/2 and decr/3 examples showed `:ok, N`; both return the integer
  directly, matching incr/2 and the decr/4 example below them.
- export/2, inspect/2 and stream/3 showed :entry tuples in the old
  {:entry, key, modified, expiration, value} order.
- stream/3 showed `true` for Cachex.put/4, which returns :ok.
- cache-routers.md typed children/2 as Supervisor.child_spec() rather
  than [Supervisor.child_spec()].
- reactive-warming.md matched {:ok, nil} from Cachex.get/3, which
  returns the value directly and nil on a miss.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation examples that no longer match behaviour

1 participant