Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(cache): add memary cache validation check for script (#5446)

baojun-zhange1872b37a9f6
diff --git a/crates/ragfs/src/cache_runtime/memory.rs b/crates/ragfs/src/cache_runtime/memory.rs
index 86a177b48..dbe9f4eb5 100644
--- a/crates/ragfs/src/cache_runtime/memory.rs
+++ b/crates/ragfs/src/cache_runtime/memory.rs
@@ -1,6 +1,6 @@
//! In-process provider used by Runtime tests and smoke validation.
-use super::provider::CacheProvider;
+use super::provider::{CacheOperation, CacheProvider};
use super::{
CacheError, CacheResult, Expiration, ListDirection, ListInsertPosition, ListInsertRequest,
ListMoveRequest, SetCondition, SetOptions, SetResult,
@@ -231,6 +231,16 @@ impl Default for MemoryMockProvider {
#[async_trait]
impl CacheProvider for MemoryMockProvider {
+ /// Rejects script execution because the in-memory provider has no Lua engine.
+ fn validate_operations(&self, operations: &[CacheOperation]) -> CacheResult<()> {
+ if operations.contains(&CacheOperation::ExecuteScript) {
+ return Err(CacheError::UnsupportedOperation(
+ CacheOperation::ExecuteScript.name().to_string(),
+ ));
+ }
+ Ok(())
+ }
+
async fn get(&self, key: &str) -> CacheResult<Option<Bytes>> {
self.ensure_open()?;
self.gets.fetch_add(1, Ordering::Relaxed);