feat(Core): add optimize and complete code

This commit is contained in:
2026-05-17 20:05:15 +03:30
parent aa944bf339
commit 4e60b7efdd
25 changed files with 858 additions and 54 deletions

View File

@@ -20,6 +20,10 @@ class Cache {
* Get cached value
*/
public function get($key, $group = 'sodino') {
if (!$this->isEnabled()) {
return false;
}
$full_key = $this->buildKey($key, $group);
// Check memory cache first
@@ -42,6 +46,10 @@ class Cache {
* Set cached value
*/
public function set($key, $value, $expiration = 3600, $group = 'sodino') {
if (!$this->isEnabled()) {
return false;
}
$full_key = $this->buildKey($key, $group);
// Set in memory cache
@@ -134,4 +142,12 @@ class Cache {
private function buildKey($key, $group) {
return "sodino_{$group}_{$key}";
}
private function isEnabled() {
if (!class_exists(__NAMESPACE__ . '\Settings')) {
return true;
}
return Settings::getInstance()->isCacheEnabled();
}
}