Problem
FDB enforces a hard limit of 100 kB per value (and 10 kB per key). Anything larger fails with value_too_large. Framework integrations we plan (Symfony/Laravel cache stores, session handlers, queue envelopes) regularly produce payloads above 100 kB (serialized objects, rendered HTML), so they need transparent chunking.
Proposal
Add chunking primitives to the library so adapters don't reinvent the wheel:
Transaction::setValueChunked(string $key, string $value, int $chunkSize = 100_000): void — writes $value split into $chunkSize-byte chunks at ordered sub-keys ($key + tuple suffix per chunk index), clears leftover chunks from a previous larger value in the same transaction (so reads never see stale tails).
Transaction::getValueChunked(string $key): ?string — reads all chunks in one range read and reassembles; returns null if the key doesn't exist.
- Snapshot-read variants if applicable.
Limits / cap
- Chunked write happens in a single transaction → atomicity is preserved, but the 10 000 000 B mutation budget applies: cap the assembled value at 8 MB (safe margin for key/tuple overhead, ~80 chunks) and throw a descriptive exception above it.
- Reads use a range read — effectively bounded by the 5 s transaction limit only; the 8 MB cap keeps writes and reads symmetric.
- Plain (non-chunked)
set()/get() behavior unchanged.
Acceptance criteria
Context
Prep work for the planned Symfony bundle / Laravel package (cache store, session handler, queue transport) discussed in the team; those adapters will all need this.
Problem
FDB enforces a hard limit of 100 kB per value (and 10 kB per key). Anything larger fails with
value_too_large. Framework integrations we plan (Symfony/Laravel cache stores, session handlers, queue envelopes) regularly produce payloads above 100 kB (serialized objects, rendered HTML), so they need transparent chunking.Proposal
Add chunking primitives to the library so adapters don't reinvent the wheel:
Transaction::setValueChunked(string $key, string $value, int $chunkSize = 100_000): void— writes$valuesplit into$chunkSize-byte chunks at ordered sub-keys ($key+ tuple suffix per chunk index), clears leftover chunks from a previous larger value in the same transaction (so reads never see stale tails).Transaction::getValueChunked(string $key): ?string— reads all chunks in one range read and reassembles; returnsnullif the key doesn't exist.Limits / cap
set()/get()behavior unchanged.Acceptance criteria
setValueChunked()/getValueChunked()onTransaction(+ snapshot variants if applicable)docs/+ CHANGELOG entryContext
Prep work for the planned Symfony bundle / Laravel package (cache store, session handler, queue transport) discussed in the team; those adapters will all need this.