mset / mget commands (cli currently only supports mget)
This commit is contained in:
@@ -15,6 +15,10 @@ pub struct Delete {
|
||||
}
|
||||
|
||||
impl Delete {
|
||||
pub fn new(key: String) -> Self {
|
||||
Self { key }
|
||||
}
|
||||
|
||||
pub async fn execute(self, db: &Database, connection: &mut Connection) -> Result<()> {
|
||||
let value = db.delete(&self.key).await;
|
||||
|
||||
@@ -31,4 +35,13 @@ impl Delete {
|
||||
|
||||
Ok(Self { key })
|
||||
}
|
||||
|
||||
pub fn put(&self, buf: &mut BytesMut) -> Result<()> {
|
||||
buf.put_short_string("delete")?;
|
||||
self.put_without_cmd_name(buf)
|
||||
}
|
||||
|
||||
pub fn put_without_cmd_name(&self, buf: &mut BytesMut) -> Result<()> {
|
||||
buf.put_short_string(&self.key)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user