Settings as clean architecture

This commit is contained in:
Shin'ya Ueoka 2018-07-22 00:01:24 +09:00
parent 0652131de8
commit 89c28d67fd
11 changed files with 176 additions and 33 deletions

View file

@ -0,0 +1,17 @@
import MemoryStorage from '../infrastructures/memory-storage';
const CACHED_SETTING_KEY = 'setting';
export default class SettingRepository {
constructor() {
this.cache = new MemoryStorage();
}
get() {
return Promise.resolve(this.cache.get(CACHED_SETTING_KEY));
}
update(value) {
return this.cache.set(CACHED_SETTING_KEY, value);
}
}