Skip to content

feat(cache): @cacheable condition / unless predicates (v26.06.42)#69

Merged
ancongui merged 1 commit into
mainfrom
feat/cacheable-condition-unless
Jun 7, 2026
Merged

feat(cache): @cacheable condition / unless predicates (v26.06.42)#69
ancongui merged 1 commit into
mainfrom
feat/cacheable-condition-unless

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

@ancongui ancongui commented Jun 7, 2026

@cacheable/cache now accept Spring-style predicates (idiomatic Python callables): condition (over the call args — False bypasses the cache entirely) and unless (over the result — True returns it without storing, e.g. skip empty/None). Tests (3): condition bypass/cache, unless excludes/stores. Gates: mypy --strict (619), ruff+format, full suite 3825.

@cacheable/cache accept Spring-style predicates (Pythonic callables):
- condition(*args): False -> bypass cache entirely (run func, no read/write).
- unless(result): True -> return result without storing (e.g. skip empty/None).

Tests: tests/cache/test_cacheable_condition_unless.py (3). Gates: mypy --strict (619),
ruff + format, full suite 3825 passed.
@ancongui ancongui merged commit 035d481 into main Jun 7, 2026
5 checks passed
@ancongui ancongui deleted the feat/cacheable-condition-unless branch June 7, 2026 11:50
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.

1 participant