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) { removeKeyNode(key, isLayer) {
if (isLayer === true) { if (isLayer === true) {
this.deleteChildrenKeyNodes(key) this.deleteChildrenKeyNodes(key)
} else {
const nodeKey = `${ConnectionType.RedisValue}/${key}`
this.nodeMap.delete(nodeKey)
} }
const dbRoot = this.getRoot() const dbRoot = this.getRoot()

View File

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