'CakePHP3 Cache::read() keys inside groups can't be read
Hi everyone i work with cakephp3 and i have implemented the cache from doc Here is my cache configuration using groups
Cache::config('users', [
'className' => 'File',
'duration' => '+1 hours',
'path' => CACHE,
'serialize' => true,
'groups' => ["users_$groupId"]
]);
And here is my key is created in a folder whose name is the name of the group
Now the prob is when i want to read the key using
Cache::read('my_key')
Doest not work because the key is stored in the folder inside Cache folder
NB: When I haven't used the groups in the cache it works well, I can read my key because the key is stored directly in the cache folder.
Thanks for any help.
Solution 1:[1]
You have to specify your custom config when reading from the cache, otherwise the default config will be used, which very likely points to the normal cache folder, hence it "works" when you don't specify any groups in your custom config.
Cache::read('my_key', 'users')
See also
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ndm |

