tourist-session-valkey/store
src/tourist-session-valkey/store.tur
a Valkey-backed session Store.
Since: v0.1.0
defn
valkey-store-new
(valkey-store-new [^borrow client : Client prefix : cstr max-age : int] :)
a Valkey-backed Store.
Parameters
| client | borrowed Valkey client (caller owns its lifecycle) | |
| prefix | key namespace, e.g. "sess" | |
| max-age | session lifetime in seconds (match SessionConfig's max-age) |
Returns
Store -- install it via session-mw, exactly like memory-store-new / file-store-new.
Example
(let [c (ok-val (client-connect "127.0.0.1" 6379))
store (valkey-store-new c "sess" 86400)]
(tourist 3000
(session-mw store (default-session-config))
...))
Since: v0.1.0
Internal definitions
__vk-state-new__vk-client__vk-prefix__vk-key-- malloc'd "<prefix>:<id>".__itoa__cstr-freeseq?__finish-- free the reply a command result carries, when it has one.vk-load-- GET <prefix>:<id>, decode the envelope, or 0 on miss.vk-save-- SET the envelope then EXPIRE the key to the session lifetime.vk-del-- DEL <prefix>:<id>.