blob: 62eb142f3b02c533eee84c0eeff228a0f48d093f (
plain)
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
|
<?php
/**
* Trait for unique cache hashes per key for each system based on db configuration which should
* be sufficient to eliminate cache mishaps.
*
* @author Jan-Hendrik Willms <tleilax+studip@gmail.com>
* @license GPL2 or any later version
* @package studip
* @subpackage cache
* @since Stud.IP 5.0
*/
trait StudipCacheKeyTrait
{
protected $cache_prefix = null;
/**
* Returns a prefix cache key based on db configuration.
*
* @param string $offset
* @return string
*/
protected function getCacheKey($offset)
{
if ($this->cache_prefix === null) {
$this->cache_prefix = md5("{$GLOBALS['DB_STUDIP_HOST']}|{$GLOBALS['DB_STUDIP_DATABASE']}");
}
return "{$this->cache_prefix}/{$offset}";
}
}
|