use valkey_module::alloc::ValkeyAlloc;
use valkey_module::{valkey_module, Context, Status, ValkeyString};
fn preload(ctx: &Context, args: &[ValkeyString]) -> Status {
let version = ctx.get_server_version().unwrap();
ctx.log_notice(&format!(
"preload for server version {:?} with args: {:?}",
version, args
));
Status::Ok
}
valkey_module! {
name: "preload",
version: 1,
allocator: (ValkeyAlloc, ValkeyAlloc),
data_types: [],
preload: preload,
commands: [],
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn accepts_configured_server_version() {
let mut context = Context::test();
context.expect_get_server_version(8, 1, 2);
let args = [ValkeyString::test("arg1")];
assert_eq!(preload(&context, &args), Status::Ok);
}
}