Skip to content

Commit 7d56dc2

Browse files
committed
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
1 parent 4ab03d8 commit 7d56dc2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎docs/comparison.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Are you caching in Python?
4444
| **Upgrade Path** | None | None | Rewrite | Rewrite | Rewrite | ✅ Seamless |
4545

4646
> [!NOTE]
47-
> **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.
4848
>
49-
> **If you need type preservation**, use `serializer='auto'`:
49+
> **If you need type preservation with a distributed backend**, use `serializer='auto'`:
5050
> ```python
5151
> @cache(serializer='auto', ttl=300)
5252
> def fn(): return (1, 2, 3) # tuple preserved on cache hit
@@ -71,7 +71,7 @@ Are you caching in Python?
7171
> - Prometheus metrics built-in (zero setup)
7272
> - **Zero code changes to upgrade**: Remove `backend=None` → distributed at any time
7373
>
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.
7575
7676
```python notest
7777
# Single-process, local development
@@ -425,7 +425,7 @@ All competitive claims validated by automated tests against real libraries (not
425425
**Key verified findings**:
426426
- `lru_cache` and `cachetools` crash on unhashable args (`TypeError`) — cachekit handles them
427427
- `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 in all modes (including L1-only) — tuples become lists via MessagePack
428+
- cachekit L1-only mode (`backend=None`) preserves all Python types (raw object storage, like `lru_cache`); distributed backends serialize via MessagePack (tuples→lists unless `serializer='auto'`)
429429
- All libraries handle primitives, bytes, datetime, Decimal, UUID, Enum identically in-memory
430430
431431
**Legacy Suite**: `pytest tests/competitive/ -v` (includes older assertion-based tests)

0 commit comments

Comments
 (0)