Skip to content

feat: add flush() to KvOps trio (ephpm_kv_flush_all)#1

Open
luthermonson wants to merge 1 commit into
mainfrom
flush-via-flush-all
Open

feat: add flush() to KvOps trio (ephpm_kv_flush_all)#1
luthermonson wants to merge 1 commit into
mainfrom
flush-via-flush-all

Conversation

@luthermonson

Copy link
Copy Markdown
Contributor

What changed

Backfills flush() into the KV-ops trio now that ePHPm v0.1.2 ships the ephpm_kv_flush_all(): bool SAPI function — for parity with the other ephpm cache packages (cache-wordpress, predis-connection, cache-laravel, cache-symfony).

  • KV-ops trioKvOpsInterface, SapiKvOps, InMemoryKvOps all gain flush(). SapiKvOps::flush() calls ephpm_kv_flush_all() behind a function_exists guard so older runtimes return false instead of fataling; InMemoryKvOps::flush() clears its $values/$deadlines arrays.

What did NOT change

KvSessionHandler deliberately does not expose flush():

  • ephpm_kv_flush_all() is global — it wipes every key in the KV store, not just session keys.
  • The SAPI exposes no SCAN, so we can't enumerate session keys by prefix to delete them selectively.
  • The recommended wholesale-invalidation pattern remains: bump the handler's prefix in config and let TTLs age the old sessions out.

flush() is available at the ops layer for anyone driving SapiKvOps directly (and to keep the interface aligned across packages).

Tests

  • InMemoryKvOpsTest::test_flush_clears_values_and_deadlines — flush wipes values AND deadlines (pttl returns -2 after).

Backfills flush() into the KV-ops trio (KvOpsInterface, SapiKvOps,
InMemoryKvOps) now that ePHPm v0.1.2 ships the ephpm_kv_flush_all():
bool SAPI function. SapiKvOps::flush() calls it behind a
function_exists() guard so older runtimes return false instead of
fataling.

KvSessionHandler deliberately does NOT expose flush() through its
public surface: a global flush wipes more than just session keys
(no SCAN means we can't enumerate by prefix), and the recommended
wholesale-invalidation pattern remains 'bump the prefix in config
and let TTLs age the old sessions out'. The flush method is
available at the ops layer for anyone driving SapiKvOps directly,
and for parity with the other ephpm cache packages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant