19 declare(strict_types=1);
45 public function __construct(
string $a_component_id,
string $a_sess_id =
'')
47 $this->component_id = $a_component_id;
48 if ($a_sess_id !==
'') {
49 $this->session_id = $a_sess_id;
51 $this->session_id = session_id();
57 if (!isset(self::$values[$this->component_id]) || !is_array(self::$values[$this->component_id])) {
62 public function set(
string $a_key,
string $a_val):
void 74 'session_id' => [
'text', $this->session_id],
75 'component_id' => [
'text', $this->component_id],
76 'vkey' => [
'text', $a_key]
78 [
'value' => [
'text', $a_val]]
82 public function get(
string $a_key):
string 88 if (isset(self::$values[$this->component_id][$a_key]) && is_array(self::$values[$this->component_id])) {
93 'SELECT value FROM usr_sess_istorage ' .
94 ' WHERE session_id = ' .
$ilDB->quote($this->session_id,
'text') .
95 ' AND component_id = ' .
$ilDB->quote($this->component_id,
'text') .
96 ' AND vkey = ' .
$ilDB->quote($a_key,
'text')
98 $rec =
$ilDB->fetchAssoc($set);
99 $value = (string) ($rec[
'value'] ??
'');
116 if (is_array($a_session_id)) {
117 $q =
'DELETE FROM usr_sess_istorage WHERE ' .
118 $DIC->database()->in(
'session_id', $a_session_id,
false,
'text');
120 $q =
'DELETE FROM usr_sess_istorage WHERE session_id = ' .
121 $DIC->database()->quote($a_session_id,
'text');
124 $DIC->database()->manipulate(
$q);
static destroySession($a_session_id)
Destroy session(s).
__construct(string $a_component_id, string $a_sess_id='')
Session based immediate storage.
initComponentCacheIfNotExists()