Describe the bug
When calling getKeys() it returns full key names with prefix that is set during service provider declaration. It is not possible to directly remove keys with method delete(). It need to be cleaned of prefix and after that successfully removed.
To Reproduce
Steps to reproduce the behavior:
$keys = $this->cache->getAdapter()->getKeys();
Array (8) (
[0] => "ph-memc-cachekey-random"
[1] => "ph-memc-cachekey-random1"
)
Provide minimal script to reproduce the issue
This won't work due of ph-memc- prefix:
foreach ($this->cache->getAdapter()->getKeys() as $key) {
$this->cache->getAdapter->delete($key);
}
But this will do:
foreach ($this->cache->getAdapter()->getKeys() as $key) {
$this->cache->getAdapter->delete(str_replace('ph-memc-', '', $key));
}
Expected behavior
Do not show internal prefix and have possibility to delete key by just passing it from getKeys() array.
foreach ($this->cache->getAdapter()->getKeys() as $key) {
$this->cache->getAdapter->delete($key);
}
Details
- Phalcon version:
4.0.5
- PHP Version:
7.4
Describe the bug
When calling
getKeys()it returns full key names with prefix that is set during service provider declaration. It is not possible to directly remove keys with methoddelete(). It need to be cleaned of prefix and after that successfully removed.To Reproduce
Steps to reproduce the behavior:
This won't work due of
ph-memc-prefix:But this will do:
Expected behavior
Do not show internal prefix and have possibility to delete key by just passing it from
getKeys()array.Details
4.0.57.4