35 lines
938 B
Rust
35 lines
938 B
Rust
use std::io::_print;
|
|
/**
|
|
|
|
# Populate Redis Example
|
|
|
|
**This script simulates the redis content provided by the LJ Python / web tool**
|
|
|
|
$ cargo run --example populate_redis
|
|
**/
|
|
|
|
use redis::{
|
|
//RedisResult,
|
|
Client,
|
|
Commands,
|
|
Connection,
|
|
};
|
|
|
|
fn do_something() -> redis::RedisResult<()> {
|
|
let client = Client::open("redis://127.0.0.1/")?;
|
|
let mut con: Connection = client.get_connection()?;
|
|
let _ = con.set("/clientkey", "/pl/0/")?;
|
|
let _ = con.set("/EDH/0", "[[1.0, 0.0, 0.0],\n [ 0.0, 1.0, 0.0],\n [ 0.0, 0.0, 1.0]]")?;
|
|
let _ = con.set("/kpps/0", "5000")?;
|
|
let _ = con.set("/intensity/0", "255")?;
|
|
let _ = con.set("/pl/0/0", "[(1000, 2000, 0), (1000, 1000, 65535), (2000, 1000, 65535), (2000, 2000, 65535), (1000, 2000, 65535)]")?;
|
|
Ok(())
|
|
}
|
|
|
|
fn main() {
|
|
match do_something() {
|
|
Err(err) => println!("Something wrong occured: {:?}", err),
|
|
Ok(..) => println!("Successfully inserted content in Redis")
|
|
}
|
|
}
|