Skip to content

Commit

Permalink
add set mem cache with time fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacky.li committed Feb 6, 2024
1 parent 9de19b1 commit 63c6660
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/wasm-actor-utils/src/client/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ pub async fn set_mem_cache(key: &str, val: Vec<u8>) -> Result<()> {
Ok(())
}

pub async fn set_mem_cache_with_time(key: &str, val: Vec<u8>, time: i32) -> Result<()> {
kvp::set(key, &val, time).await?;
Ok(())
}

/// Return a cache value.
pub async fn get_mem_cache(key: &str) -> Result<Vec<u8>> {
let rs: Vec<u8> = kvp::get(key).await?.ok_or_err_else(|| "")?;
Expand Down

0 comments on commit 63c6660

Please sign in to comment.