PortaBilling API

SessionStorageInterface

Interface for session storage

Table of Contents

clean()  : void
Cleans the billing session data from storage.
load()  : array<string|int, mixed>|null
Loads the session data from storage and return it
save()  : void
Saves session data to storage. Implementation should rely that the storage was locked by $this->lock() call, write and release after the lock.
startUpdate()  : bool
Called by biling session manager process when it start to refresh token/relogin

Methods

clean()

Cleans the billing session data from storage.

public clean() : void

Called after implicit logoff

Return values
void —

load()

Loads the session data from storage and return it

public load() : array<string|int, mixed>|null

Implementation MUST wait for lock to release if it set by concurent process, lock it for reading and unlock after read the content.

Return values
array<string|int, mixed>|null —

null if no sesion data stored

save()

Saves session data to storage. Implementation should rely that the storage was locked by $this->lock() call, write and release after the lock.

public save(array<string|int, mixed> $session) : void
Parameters
$session : array<string|int, mixed>

data to save

Return values
void —

startUpdate()

Called by biling session manager process when it start to refresh token/relogin

public startUpdate() : bool

If session data stroage is shared over different processes with async start, it is necessary to avoid concurent login/tocken update processes. Therefore, the first process who started login or token refresh process must lock the storage and neither other process should try to login or refresh outdated tocken.

SessionManager calls startUpdate which should put storage in locked-for-update state and return true or return false if the storage already locked for update. If got 'false', the process should re-load the session data with load()

Return values
bool —
  • true if got lock for update,
  • false if other process already updates the session storage

Search results