Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
SessionCache.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\cache\objects
;
4
5
use
Ubiquity\utils\http\USession
;
6
use
Ubiquity\utils\base\UString
;
7
8
class
SessionCache
{
9
private
$session
;
10
const
ENTRY_KEY
=
"_session_cache"
;
11
12
public
function
__construct
(){
13
$this->session=
new
USession
();
14
$this->session->start();
15
}
16
17
public
function
fetch
($key) {
18
return
$this->session->get($this->
getEntryKey
($key));
19
}
20
21
public
function
clear
() {
22
foreach
($_SESSION as $k=>$notUsed){
23
if
(UString::startswith($k, self::ENTRY_KEY.
"."
)){
24
unset ( $_SESSION [$k] );
25
}
26
}
27
}
28
29
public
function
exists
($key) {
30
return
$this->session->exists($this->
getEntryKey
($key));
31
}
32
33
public
function
getEntryKey
($key) {
34
return
self::ENTRY_KEY.
'.'
.$key;
35
}
36
37
public
function
store
($key, $object) {
38
$key=$this->
getEntryKey
($key);
39
$this->session->set($key, $object);
40
}
41
42
43
public
function
remove
($key) {
44
$this->session->delete($this->
getEntryKey
($key));
45
}
46
}
47
Ubiquity\cache\objects\SessionCache
Definition
SessionCache.php:8
Ubiquity\cache\objects\SessionCache\__construct
__construct()
Definition
SessionCache.php:12
Ubiquity\cache\objects\SessionCache\ENTRY_KEY
const ENTRY_KEY
Definition
SessionCache.php:10
Ubiquity\cache\objects\SessionCache\fetch
fetch($key)
Definition
SessionCache.php:17
Ubiquity\cache\objects\SessionCache\clear
clear()
Definition
SessionCache.php:21
Ubiquity\cache\objects\SessionCache\$session
$session
Definition
SessionCache.php:9
Ubiquity\cache\objects\SessionCache\store
store($key, $object)
Definition
SessionCache.php:37
Ubiquity\cache\objects\SessionCache\getEntryKey
getEntryKey($key)
Definition
SessionCache.php:33
Ubiquity\cache\objects\SessionCache\exists
exists($key)
Definition
SessionCache.php:29
Ubiquity\utils\base\UString
String utilities.
Definition
UString.php:15
Ubiquity\utils\http\USession
Http Session utilities This class is part of Ubiquity.
Definition
USession.php:16
Ubiquity\cache\objects
Definition
SessionCache.php:3
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
cache
objects
SessionCache.php
Generated on Sun Dec 10 2023 15:04:11 for
Ubiquity
by
doxygen
1.9.8