Skip to content

Instantly share code, notes, and snippets.

@computermouth
Last active February 7, 2024 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save computermouth/432cd0c71aef66bb651bb6b0aaf4dfeb to your computer and use it in GitHub Desktop.
Save computermouth/432cd0c71aef66bb651bb6b0aaf4dfeb to your computer and use it in GitHub Desktop.
// ==== CURRENT ====
// insert
mystore.insert(&key1, MSG2);
// insert async
let in_handle = mystore.insert_async(&key1, MSG2)?;
store.pending_insert_wait(in_handle);
// (in-review) buildable insert
store.build_insert(&key1, MSG1)
.mode(InsertMode::Add)
.time_to_live(std::time::Duration::from_secs(5))
.metadata("mymetadata")
.if_generation_match(1234)
.execute();
// (todo) buildable insert async
let in_handle = store.build_insert(&key1, MSG1)
.mode(InsertMode::Add)
.time_to_live(std::time::Duration::from_secs(5))
.metadata("mymetadata")
.if_generation_match(1234)
.execute_async();
store.pending_insert_wait(in_handle);
// ==== ALTERNATIVE ====
// buildable without options
mystore.insert(&key1, MSG2).execute();
// async buildable without options
let in_handle = mystore.insert(&key1, MSG2).execute_async()?;
store.pending_insert_wait(in_handle);
// buildable with options
store.insert(&key1, MSG1)
.mode(InsertMode::Add)
.time_to_live(std::time::Duration::from_secs(5))
.metadata("mymetadata")
.if_generation_match(1234)
.execute();
// async buildable with options
let in_handle = store.build_insert(&key1, MSG1)
.mode(InsertMode::Add)
.time_to_live(std::time::Duration::from_secs(5))
.metadata("mymetadata")
.if_generation_match(1234)
.execute_async();
store.pending_insert_wait(in_handle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment