mirror of https://github.com/node-red/node-red.git
Fix up cache scope
parent
4be6d57d98
commit
20187b51b1
|
@ -135,10 +135,10 @@
|
||||||
}
|
}
|
||||||
const url = `context/${scope}/${encodeURIComponent(searchKey)}?store=${store}&keysOnly`
|
const url = `context/${scope}/${encodeURIComponent(searchKey)}?store=${store}&keysOnly`
|
||||||
if (contextCache[url]) {
|
if (contextCache[url]) {
|
||||||
console.log('CACHED', url)
|
// console.log('CACHED', url)
|
||||||
done()
|
done()
|
||||||
} else {
|
} else {
|
||||||
console.log('GET', url)
|
// console.log('GET', url)
|
||||||
$.getJSON(url, function(data) {
|
$.getJSON(url, function(data) {
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
contextCache[url] = true
|
contextCache[url] = true
|
||||||
|
@ -147,9 +147,9 @@
|
||||||
const keyPrefix = searchKey + (searchKey.length > 0 ? '.' : '')
|
const keyPrefix = searchKey + (searchKey.length > 0 ? '.' : '')
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(key)) {
|
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(key)) {
|
||||||
contextKnownKeys[store].add(keyPrefix + key)
|
contextKnownKeys[scope][store].add(keyPrefix + key)
|
||||||
} else {
|
} else {
|
||||||
contextKnownKeys[store].add(searchKey + "[\""+key.replace(/"/,"\\\"")+"\"]")
|
contextKnownKeys[scope][store].add(searchKey + "[\""+key.replace(/"/,"\\\"")+"\"]")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
done()
|
done()
|
||||||
|
@ -179,12 +179,12 @@
|
||||||
const searchKey = keyParts.join('.')
|
const searchKey = keyParts.join('.')
|
||||||
|
|
||||||
getContextKeysFromRuntime(scope, store, searchKey, function() {
|
getContextKeysFromRuntime(scope, store, searchKey, function() {
|
||||||
if (contextKnownKeys[store].has(key) || key.endsWith(']')) {
|
if (contextKnownKeys[scope][store].has(key) || key.endsWith(']')) {
|
||||||
getContextKeysFromRuntime(scope, store, key, function() {
|
getContextKeysFromRuntime(scope, store, key, function() {
|
||||||
done(contextKnownKeys[store])
|
done(contextKnownKeys[scope][store])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
done(contextKnownKeys[store])
|
done(contextKnownKeys[scope][store])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue