Skip to content

Core\Session

Keeps values for one visitor from one request to the next. A short-lived value is kept until the browser closes or the visitor is inactive for [session] short_lived. A long-lived value is kept for [session] long_lived. The first call of any method opens the session. By default, the values are saved in a SQLite file in the data folder. [session] backend = "shared" saves them in the shared cache instead.

Members

12 members.

MemberSignature
setShortLivedsetShortLived(string $key, mixed $value): void
setLongLivedsetLongLived(string $key, mixed $value): void
getget(string $key): mixed
removeremove(string $key): void
clearShortLivedclearShortLived(): void
clearLongLivedclearLongLived(): void
clearAllclearAll(): void
regenerateregenerate(): void
setShortLivedSecretsetShortLivedSecret(string $key, secret string $value, array<secret bytes> $keys): void
setLongLivedSecretsetLongLivedSecret(string $key, secret string $value, array<secret bytes> $keys): void
getSecretgetSecret(string $key, array<secret bytes> $keys): ?secret string
openWithIdentifieropenWithIdentifier(string $id): void

Example apps

These complete apps use this class. You can download and run each one.

  • Chat: A chat app with rooms, WebSockets and SQLite. One Novis server sends the pages and runs every connection, with no separate WebSocket server and no library.