- Created a new eveai_chat plugin to support the new dynamic possibilities of the Specialists. Currently only supports standard Rag retrievers (i.e. no extra arguments).
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace EveAI\Chat;
|
||||
|
||||
class CacheManager {
|
||||
private const SETTINGS_CACHE_KEY = 'eveai_settings_cache';
|
||||
private const CACHE_EXPIRATION = 3600; // 1 hour
|
||||
|
||||
public static function get_settings(): array {
|
||||
$cached = wp_cache_get(self::SETTINGS_CACHE_KEY);
|
||||
|
||||
if ($cached !== false) {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
$settings = get_option('eveai_chat_settings', []);
|
||||
wp_cache_set(self::SETTINGS_CACHE_KEY, $settings, '', self::CACHE_EXPIRATION);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
public static function clear_settings_cache(): void {
|
||||
wp_cache_delete(self::SETTINGS_CACHE_KEY);
|
||||
}
|
||||
|
||||
public static function maybe_clear_caches(): void {
|
||||
if (defined('WP_CACHE') && WP_CACHE) {
|
||||
wp_cache_flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user