aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories/FindRepository.ts
blob: be5628438c92cd0a8065e02d3295ccbf06b4b9a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { injectable } from "tsyringe";
import MemoryStorage from "../infrastructures/MemoryStorage";

const FIND_KEYWORD_KEY = "find-keyword";

@injectable()
export default class FindRepository {
  private cache: MemoryStorage;

  constructor() {
    this.cache = new MemoryStorage();
  }

  getKeyword(): Promise<string> {
    return Promise.resolve(this.cache.get(FIND_KEYWORD_KEY));
  }

  setKeyword(keyword: string): Promise<any> {
    this.cache.set(FIND_KEYWORD_KEY, keyword);
    return Promise.resolve();
  }
}