aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-06-02 10:45:54 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-06-02 10:45:54 +0000
commit2e48a0c8a0079b0ef73f02d77e2c193c2444d6e8 (patch)
treed6b15873a4c292c579e6bb643867bf4f2eadf260 /lib
parent27e1257afb691b317e4b8ff48f0b8c983e4bac24 (diff)
use session.gc_maxlifetime for session storage in cache, fixes #604
Closes #604 Merge request studip/studip!1786
Diffstat (limited to 'lib')
-rw-r--r--lib/phplib/CT_Cache.class.php42
1 files changed, 27 insertions, 15 deletions
diff --git a/lib/phplib/CT_Cache.class.php b/lib/phplib/CT_Cache.class.php
index 8b51fbe..311b27c 100644
--- a/lib/phplib/CT_Cache.class.php
+++ b/lib/phplib/CT_Cache.class.php
@@ -5,52 +5,64 @@
## PHPLIB Data Storage Container using Stud.IP cache
## for use with Stud.IP and cache only!
-class CT_Cache {
- const CACHE_KEY_PREFIX = 'session_data';
- const SESSION_LIFETIME = 7200;
+class CT_Cache
+{
+ protected const CACHE_KEY_PREFIX = 'session_data';
+ protected const SESSION_LIFETIME = 7200;
private $cache;
- function ac_start() {
+ public function ac_start()
+ {
$this->cache = StudipCacheFactory::getCache();
}
- function ac_get_lock() {
+ public function ac_get_lock()
+ {
}
- function ac_release_lock() {
+ public function ac_release_lock()
+ {
}
- function ac_newid($str, $name = null) {
+ public function ac_newid($str, $name = null)
+ {
return $this->ac_get_value($str) === false ? $str : false;
}
- function ac_store($id, $name, $str) {
+ public function ac_store($id, $name, $str)
+ {
$cache_key = self::CACHE_KEY_PREFIX . '/' . $id;
- return $this->cache->write($cache_key, $str, self::SESSION_LIFETIME);
+ return $this->cache->write($cache_key, $str, ini_get('session.gc_maxlifetime') ?: self::SESSION_LIFETIME);
}
- function ac_delete($id, $name = null) {
+ public function ac_delete($id, $name = null)
+ {
$cache_key = self::CACHE_KEY_PREFIX . '/' . $id;
$this->cache->expire($cache_key);
}
- function ac_gc($gc_time, $name = null) {
+ public function ac_gc($gc_time, $name = null)
+ {
}
- function ac_halt($s) {
+ public function ac_halt($s)
+ {
echo "<b>$s</b>";
exit;
}
- function ac_get_value($id, $name = null) {
+ public function ac_get_value($id, $name = null)
+ {
$cache_key = self::CACHE_KEY_PREFIX . '/' . $id;
return $this->cache->read($cache_key);
}
- function ac_get_changed($id, $name = null) {
+ public function ac_get_changed($id, $name = null)
+ {
}
- function ac_set_changed($id, $name, $timestamp) {
+ public function ac_set_changed($id, $name, $timestamp)
+ {
}
}