> ## Documentation Index
> Fetch the complete documentation index at: https://whatsapp-rust.jlucaso.com/llms.txt
> Use this file to discover all available pages before exploring further.

# June 9, 2026 — Signal session cache: Arc-shared records, zero-copy peek

> peek_session now returns Arc<SessionRecord> — cache hits are a refcount bump instead of a 1–2 KB deep clone. Breaking: return type changes from Option<SessionRecord> to Option<Arc<SessionRecord>>.

## Performance

**Signal session cache: `Arc`-shared records, zero-copy `peek_session` ([#809](https://github.com/oxidezap/whatsapp-rust/pull/809))**

`SessionEntry::Present` now wraps `Arc<SessionRecord>` instead of `Box<SessionRecord>`, aligning sessions with the sender-key cache pattern already in use.

**`peek_session`** — the non-destructive read used by retry-receipt handling and LID-migration checks — previously deep-cloned the full `SessionRecord` on every call (1–2 KB: archived session states plus skipped message keys). It now returns `Option<Arc<SessionRecord>>`, so a cache hit is a refcount bump. The backend-miss path wraps the deserialized record once in `Arc` and shares the same allocation between the cache slot and the return value, eliminating a second clone the old code always paid.

**`get_session`** (checkout) uses `Arc::try_unwrap` to move the record out in the common case — the entry is unique in steady state, so this is a zero-cost move. A clone only occurs when a peek's short-lived `Arc` is still alive at checkout time (the rare overlap the old code paid for on every peek).

## Breaking changes

**`peek_session` return type: `Option<SessionRecord>` → `Option<Arc<SessionRecord>>`** (pre-1.0)

Read-only consumers are source-compatible via `Deref` — code that only reads through the returned value compiles unchanged. Code that requires an owned `SessionRecord` (e.g., passing by value to a function) should dereference and clone: `(*arc).clone()`.
