You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7d56dc2
Browse filesBrowse the repository at this point in the historyBrowse files
docs: update comparison.md type preservation claims after #73 fix
L1-only mode now stores raw Python objects (no serialization), so types
are preserved. Update three locations that incorrectly claimed tuples
become lists "across all backends and modes."
Closes#74
> **Type preservation**: The default serializer (MessagePack/`StandardSerializer`) converts tuples to lists and frozensets to lists — this is consistent across all backends and modes, and ensures cross-language SDK compatibility (Rust, TypeScript, PHP).
47
+
> **Type preservation**: In L1-only mode (`backend=None`), Python types are preserved exactly — tuples, sets, frozensets all survive cache hits (raw object storage, no serialization). When using a distributed backend (Redis, Memcached, CachekitIO), the default `StandardSerializer` converts tuples to lists and frozensets to lists for cross-language SDK compatibility.
48
48
>
49
-
> **If you need type preservation**, use `serializer='auto'`:
49
+
> **If you need type preservation with a distributed backend**, use `serializer='auto'`:
50
50
> ```python
51
51
>@cache(serializer='auto', ttl=300)
52
52
>deffn(): return (1, 2, 3) # tuple preserved on cache hit
@@ -71,7 +71,7 @@ Are you caching in Python?
71
71
>- Prometheus metrics built-in (zero setup)
72
72
>-**Zero code changes to upgrade**: Remove `backend=None` → distributed at any time
73
73
>
74
-
>**Tradeoff**: The default serializer converts tuples to lists for cross-language compatibility. Use `serializer='auto'` to preserve Python types (tuples, sets, frozensets). See note above.
74
+
>**Type safe**: L1-only mode stores raw Python objects — tuples, sets, frozensets are preserved exactly like `lru_cache`. No serialization overhead.
75
75
76
76
```python notest
77
77
# Single-process, local development
@@ -425,7 +425,7 @@ All competitive claims validated by automated tests against real libraries (not
425
425
**Key verified findings**:
426
426
-`lru_cache`and`cachetools` crash on unhashable args (`TypeError`) — cachekit handles them
427
427
-`lru_cache` on async functions caches the coroutine, not the result (`RuntimeError` on second await) — no stdlib fix as of Python 3.12+
428
-
- cachekit serializes inallmodes (including L1-only) — tuples become lists via MessagePack
0 commit comments