Security upgrades

This commit is contained in:
2020-07-15 19:54:48 +02:00
parent 59cc6c54cd
commit ad8ed283d2
3164 changed files with 408897 additions and 28 deletions

View File

@@ -0,0 +1,22 @@
// Used https://github.com/thinkloop/multi-key-cache as inspiration
const multiKeyStore = {
set: (cache, key1, key2, value) => {
let subCache = cache.get(key1);
if (!subCache) {
subCache = new Map();
cache.set(key1, subCache);
}
subCache.set(key2, value);
},
get: (cache, key1, key2) => {
const subCache = cache.get(key1);
return subCache ? subCache.get(key2) : undefined;
},
delete: (cache, key1, key2) => {
const subCache = cache.get(key1);
subCache.delete(key2);
}
};
export default multiKeyStore;