Feat: implement per operator settings cache
Fix: fix linter-found issues Chore: move findOperatorId to own middleware file Chore: delete old routes.js file and rename new-routes.js to routes.js Fix: PR fixes
This commit is contained in:
parent
85235eaa13
commit
558317e9f3
30 changed files with 232 additions and 860 deletions
|
|
@ -1,19 +1,26 @@
|
|||
const _ = require('lodash/fp')
|
||||
const state = require('./state')
|
||||
|
||||
const getTimestamp = () => state.settingsCache.timestamp
|
||||
const getTimestamp = (operatorId) => state.settingsCache[operatorId] ? state.settingsCache[operatorId].timestamp : null
|
||||
|
||||
const getCache = () => state.settingsCache.cache
|
||||
const getCache = (operatorId) => state.settingsCache[operatorId] ? state.settingsCache[operatorId].cache : null
|
||||
|
||||
const setTimestamp = (newTimestamp) => state.settingsCache.timestamp = newTimestamp
|
||||
const setTimestamp = (operatorId, newTimestamp) => {
|
||||
state.settingsCache = _.set([operatorId, 'timestamp'], newTimestamp, state.settingsCache)
|
||||
}
|
||||
|
||||
const setCache = (newCache) => state.settingsCache.cache = newCache
|
||||
const setCache = (operatorId, newCache) => {
|
||||
state.settingsCache = _.set([operatorId, 'cache'], newCache, state.settingsCache)
|
||||
}
|
||||
|
||||
const clearCache = () => state.settingsCache.cache = null
|
||||
const clear = (operatorId) => {
|
||||
state.settingsCache = _.set([operatorId], null, state.settingsCache)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getTimestamp,
|
||||
getCache,
|
||||
setTimestamp,
|
||||
setCache,
|
||||
clearCache
|
||||
}
|
||||
clear
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue