src/app/share/cache.service.ts
Properties |
Methods |
constructor()
|
Defined in src/app/share/cache.service.ts:8
|
get | ||||||
get(key: string)
|
||||||
Defined in src/app/share/cache.service.ts:12
|
||||||
Type parameters :
|
||||||
Parameters :
Returns :
T
|
set |
set(key: string, value: any)
|
Defined in src/app/share/cache.service.ts:16
|
Returns :
void
|
unset | ||||
unset(key)
|
||||
Defined in src/app/share/cache.service.ts:20
|
||||
Parameters :
Returns :
void
|
cache |
Type : literal type
|
Default value : {}
|
Defined in src/app/share/cache.service.ts:8
|
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class CacheService {
cache: { [key: string]: any } = {};
constructor() { }
get<T>(key: string): T {
return this.cache[key];
}
set(key: string, value: any) {
this.cache[key] = value;
}
unset(key) {
this.cache[key] = null;
}
}