Geplace GETDEL by pipelined GET and DEL commands. (#682)
Some checks failed
CI / tests (postgres) (push) Has been cancelled
CI / tests (sqlite) (push) Has been cancelled
CI / dist (postgres) (push) Has been cancelled
CI / dist (sqlite) (push) Has been cancelled

GETDEL was added in Redis 6.2, but is unfortunately not supported on all Azure Cache for Redis tiers.

Fixes #680.
This commit is contained in:
Lukas Kirner 2025-05-21 11:15:05 +02:00 committed by GitHub
parent 10731c2be5
commit b8e14058f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,7 +24,10 @@ pub async fn save(df: &internal::DownlinkFrame) -> Result<()> {
pub async fn get_and_del(id: u32) -> Result<internal::DownlinkFrame, Error> {
let key = redis_key(format!("frame:{}", id));
let v: Vec<u8> = redis::cmd("GETDEL")
let (v, _): (Vec<u8>, u8) = redis::pipe()
.cmd("GET")
.arg(key.clone())
.cmd("DEL")
.arg(key)
.query_async(&mut get_async_redis_conn().await?)
.await?;