- 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:
Josako
2024-11-26 13:35:29 +01:00
parent 7702a6dfcc
commit 07d89d204f
42 changed files with 1771 additions and 989 deletions

View File

@@ -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();
}
}
}