Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AclCacheProvider.php
Go to the documentation of this file.
1<?php
3
11
21
22 public function __construct() {
23 $cacheKeys = $this->getCacheKeys();
24 foreach ($cacheKeys as $key) {
25 $this->createCache($key);
26 }
27 }
28
29 protected function getCacheKeys(): array {
30 return [
31 $this->getRootKey('acls'),
32 $this->getRootKey(Role::class),
33 $this->getRootKey(Resource::class),
34 $this->getRootKey(Permission::class)
35 ];
36 }
37
38 protected function loadAllPart($class): array {
39 $this->parts[$class] = CacheManager::$cache->fetch($this->getRootKey($class));
40 return parent::loadAllPart($class);
41 }
42
43 public function loadAllAcls(): array {
44 $this->aclsArray = CacheManager::$cache->fetch($this->getRootKey('acls'));
45 return parent::loadAllAcls();
46 }
47
48 public function isAutosave(): bool {
49 return false;
50 }
51
52 public function saveAll(): void {
53 CacheManager::$cache->store($this->getRootKey('acls'), $this->aclsArray);
54 $classes = [
55 Role::class,
56 Resource::class,
57 Permission::class
58 ];
59 foreach ($classes as $class) {
60 CacheManager::$cache->store($this->getRootKey($class), $this->parts[$class] ?? []);
61 }
62 }
63
64 public function cacheUpdated(): bool {
65 $old=CacheManager::$cache->fetch($this->getRootKey('acls'));
66 if ($old!=$this->aclsArray) {
67 return true;
68 }
69 $classes = [
70 Role::class,
71 Resource::class,
72 Permission::class
73 ];
74 foreach ($classes as $class) {
75 $old=CacheManager::$cache->fetch($this->getRootKey($class));
76 if ($old!=($this->parts[$class]??[])) {
77 return true;
78 }
79 }
80 return false;
81 }
82
83 public function getDetails(): array {
84 return [
85 'lock' => 'In memory or annotations cache'
86 ];
87 }
88}
89
Manager for caches (Router, Rest, models).
Ubiquity\security\acl\cache\traits$AclCacheTrait This class is part of Ubiquity.
Ubiquity\security\acl\models$AbastractAclElement This class is part of Ubiquity.
Ubiquity\security\acl\models$AclElement This class is part of Ubiquity.
Ubiquity\security\acl\models$Permission This class is part of Ubiquity.
Ubiquity\security\acl\models$Resource This class is part of Ubiquity.
Definition Resource.php:12
Ubiquity\security\acl\models$Role This class is part of Ubiquity.
Definition Role.php:12
Ubiquity\security\acl\persistence$AclArrayProvider This class is part of Ubiquity.
Ubiquity\security\acl\persistence$AclCacheProvider This class is part of Ubiquity.
loadAllAcls()
{{AclElement[]}\Ubiquity\security\acl\persistence\AclProviderInterfaceloadAllAcls()}