-
Notifications
You must be signed in to change notification settings - Fork 0
/
SessionDriver.php
46 lines (38 loc) · 1.3 KB
/
SessionDriver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Snicco\Component\Session\Driver;
use Snicco\Component\Session\Exception\CouldNotDestroySession;
use Snicco\Component\Session\Exception\CouldNotReadSessionContent;
use Snicco\Component\Session\Exception\CouldNotWriteSessionContent;
use Snicco\Component\Session\Exception\UnknownSessionSelector;
use Snicco\Component\Session\ValueObject\SerializedSession;
interface SessionDriver
{
/**
* Returns the data of the session with the given selector. It is NOT
* required to check if the session can still be considered active.
*
* @throws UnknownSessionSelector
* @throws CouldNotReadSessionContent
*/
public function read(string $selector): SerializedSession;
/**
* @throws CouldNotWriteSessionContent
*/
public function write(string $selector, SerializedSession $session): void;
/**
* @throws CouldNotDestroySession
*/
public function destroy(string $selector): void;
/**
* @throws CouldNotDestroySession
*/
public function gc(int $seconds_without_activity): void;
/**
* Update the last activity of the session.
*
* @throws UnknownSessionSelector
* @throws CouldNotWriteSessionContent
*/
public function touch(string $selector, int $current_timestamp): void;
}