41 private readonly ?
ilIniFile $client_ini = null,
44 if ($this->client_ini !== null) {
52 return $this->config ?? $this->
toConfig();
67 $this->active = (bool) $client_ini->
readVariable(
'cache',
'activate_global_cache');
68 $service_type = $client_ini->
readVariable(
'cache',
'global_cache_service_type');
69 if(is_numeric($service_type)) {
70 $service_type = match ((
int) $service_type) {
71 0 => Config::PHPSTATIC,
72 2 => Config::MEMCACHED,
74 default => Config::PHPSTATIC,
77 $this->service = (string) $service_type;
78 $read_group = $client_ini->
readGroup(
'cache_activated_components');
80 $this->components = array_unique(
81 array_map(
static function (
string $component):
string {
82 if ($component ===
'all') {
86 }, array_keys($read_group))
89 if ($this->db !== null) {
91 foreach ($repo->getNodes() as $node) {
106 $client_ini->
setVariable(
'cache',
'activate_global_cache', $this->active ?
'1' :
'0');
107 $client_ini->
setVariable(
'cache',
'global_cache_service_type', $this->service);
108 $client_ini->
removeGroup(
'cache_activated_components');
109 $client_ini->
addGroup(
'cache_activated_components');
110 foreach ($this->components as $component) {
111 $client_ini->
setVariable(
'cache_activated_components', $component,
'1');
115 if ($this->db !== null) {
118 foreach ($this->nodes as $node) {
123 return $client_ini->
write();
138 $this->nodes[] = $node;
148 $this->components = [];
153 $this->components = [
'*'];
158 $this->components[] = $component;
addGroup(string $a_group_name)
adds a new group
write()
save ini-file-data to filesystem
readFromIniFile(ilIniFile $client_ini)
setVariable(string $a_group_name, string $a_var_name, string $a_var_value)
sets a variable in a group
__construct(private readonly ?ilIniFile $client_ini=null, private readonly ?ilDBInterface $db=null)
readGroup(string $a_group_name)
returns an associative array of the variables in one group
addMemcachedNode(Node $node)
removeGroup(string $a_group_name)
removes a group
storeToIniFile(ilIniFile $client_ini)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addActivatedComponent(string $component)
readVariable(string $a_group, string $a_var_name)
reads a single variable from a group
setService(string $service)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
resetActivatedComponents()