Repository navigation
feat: batch doFetch/doSave through ephpm_kv_mget/mset (ePHPm v0.13) - #4
Merged
Merged
Conversation
doFetch() reads a batch with one ephpm_kv_mget call and doSave() writes each same-lifetime batch with one ephpm_kv_mset call; a refused mset is retried key by key so the exact failed ids are still reported. Both are feature-detected (older runtimes keep the per-key loop). doClear() is unchanged: ephpm_kv_scan is not cluster-complete, so a namespaced clear still returns false; the reason is documented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses ePHPm v0.13.0's multi-key KV functions when they are present. Both are feature-detected with
function_exists, and older runtimes keep today's per-key path.Changes
doFetch(): a batch is read with oneephpm_kv_mgetcall. If the call fails as a whole (false), it falls back to per-keyget.doSave(): each batch is written with oneephpm_kv_msetcall.AbstractAdaptergroupsdoSave()calls by lifetime, so a single TTL per batch is exact.msetonly reports overall success or failure, so if it is refused (memory limit) the batch is retried key by key. That keeps the exact list of failed idsdoSave()must return; re-writing keys that already landed is harmless.doClear()is unchanged. It never scanned, so per the brief it stays as it is. The comment, class docblock and README now explain whyephpm_kv_scanis not used for a namespaced clear: in a cluster it lists only the local node's keyspace, and string values abovesmall_key_thresholdlive only on their replica nodes. A scan-and-delete could report success while stale entries survive on other nodes.ExtendedKvOpsInterface. CustomKvOpsInterfacebackends (e.g. the existingFailingSetKvOpstest double) still work and take the per-key path.InMemoryKvOpsimplementsmget/mset.new InMemoryKvOps([])behaves like an older runtime.Tests
MultiKeyOpsTestuses a recording spy to cover: one mget forgetItems(), the fallbacks without mget and on a failing mget, one mset per commit with the batch TTL, no-expiry saves, a refused mset falling back to per-key set, and the fallback without mset.SapiKvOpsTestadds stubs and cases forsupports(),mgetandmset.