fix: key deletion operation was incomplete (#348)

This commit is contained in:
Lykin 2024-09-28 11:55:38 +08:00
parent aa3383db43
commit cb428747e2
2 changed files with 10 additions and 5 deletions

View File

@ -296,6 +296,9 @@ export class RedisServerState {
removeKeyNode(key, isLayer) {
if (isLayer === true) {
this.deleteChildrenKeyNodes(key)
} else {
const nodeKey = `${ConnectionType.RedisValue}/${key}`
this.nodeMap.delete(nodeKey)
}
const dbRoot = this.getRoot()

View File

@ -708,17 +708,19 @@ const useBrowserStore = defineStore('browser', {
}
let match = prefix
const separator = this.getSeparator(server)
if (!endsWith(match, separator)) {
match += separator + '*'
} else {
match += '*'
if (!isEmpty(match)) {
if (!endsWith(match, separator)) {
match += separator + '*'
} else {
match += '*'
}
}
// FIXME: ignore original match pattern due to redis not support combination matching
const { match: originMatch, type: keyType, exact } = this.getKeyFilter(server)
const { keys, maxKeys, success } = await this._loadKeys({
server,
db,
match: originMatch,
match: match || originMatch,
exact: false,
matchType: keyType,
all: true,