http.session.memory
import http.session.memory
httplifts part of this module out to its own top level; each name below is shown with the path that reaches it. Anything still spelledhttp.session.memory.*needsimport http.session.memory.
The session store that keeps everything in the isolate’s own heap.
Classes
MemoryStore
class http.session.MemoryStore < SessionStore
Keeps sessions in a dictionary, for as long as the isolate that made the store lives.
It is the right store for a test, where a session has to survive a handful of requests and nothing more, and for a single-process development server. It is the wrong store for anything serving real traffic:
- Nothing survives a restart. Every session in flight ends when the process does, deploy included.
- Nothing is shared.
http.serve()runs each worker in its own isolate with its own heap, so a browser whose next request lands on a different worker arrives with a session that worker has never heard of.
FileStore has neither problem and needs no more setup than this does,
which is why it, and not this, is the default.
- printable — has a
@to_string(), soechoandprint()show something useful
Constructor
http.session.MemoryStore(options: ?dict)
Parameters
options(?dict) —gc_probability(default0.01)
MemoryStore.length()
http.session.MemoryStore.length() -> number
How many sessions are held, expired ones that have not yet been swept included.
Returns number
MemoryStore.clear()
http.session.MemoryStore.clear()
Drops every session at once.
MemoryStore.read()
http.session.MemoryStore.read(key: string)
MemoryStore.write()
http.session.MemoryStore.write(key: string, payload: string, expires_at: number)
MemoryStore.touch()
http.session.MemoryStore.touch(key: string, expires_at: number)
MemoryStore.destroy()
http.session.MemoryStore.destroy(key: string)
MemoryStore.gc()
http.session.MemoryStore.gc(now: number)
MemoryStore.to_string()
http.session.MemoryStore.to_string()
2026, Richard Ore and Zuri contributors