aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories/FindRepository.ts
blob: 813e06532819864242d145b5548461099c31ee8d (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<void> {
    this.cache.set(FIND_KEYWORD_KEY, keyword);
    return Promise.resolve();
  }
}