Merge "[1707-OS] Updated license text according to the"
[sdc.git] / catalog-ui / src / app / services / cache-service.ts
1 'use strict';
2 import {Dictionary} from "app/utils";
3
4 interface ICacheService {
5     get(key:string):any;
6     set(key:string, value:any):void;
7 }
8
9 export class CacheService implements ICacheService {
10
11     private storage:Dictionary<string, any>;
12
13     constructor() {
14         this.storage = new Dictionary<string, any>();
15     };
16
17     public get = (key:string):any => {
18         return this.storage.getValue(key);
19     };
20
21     public set = (key:string, value:any):void => {
22         this.storage.setValue(key, value);
23     };
24
25     public remove = (key:string):void => {
26         if (this.storage.containsKey(key)) {
27             this.storage.remove(key);
28         }
29     };
30
31     public contains = (key:string):boolean => {
32         return this.storage.containsKey(key);
33     };
34 }