Skip to content

Commit

Permalink
fix: KEYS command did not exclude expired entries
Browse files Browse the repository at this point in the history
  • Loading branch information
cfanbo committed Aug 22, 2024
1 parent 5ea55c9 commit 50bffa0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,11 @@ impl Server {
for v in store.keys() {
let v1 = String::from_utf8(v.to_vec()).unwrap();
if util::match_key(&k, &v1) {
result.push(OwnedFrame::BulkString(v.clone()));
if let Ok(entry) = store.get_entry(v.as_slice()) {
if !entry.is_expired() {
result.push(OwnedFrame::BulkString(v.clone()));
}
}
}
}
Ok(OwnedFrame::Array(result))
Expand Down

0 comments on commit 50bffa0

Please sign in to comment.