20 lines
328 B
JavaScript
20 lines
328 B
JavaScript
// implement a cluster-wide cache which is in-memory for each instance
|
|
|
|
export class Cache {
|
|
|
|
constructor(name) {
|
|
this.name = name
|
|
this.cache = {}
|
|
}
|
|
|
|
async get(key) {
|
|
return this.cache[key]
|
|
}
|
|
|
|
async set(key, value) {
|
|
this.cache[key] = value
|
|
// todo broadcast
|
|
}
|
|
}
|
|
|