fengxiang
2018-07-11 12b04f145bae740e1971036b1e2dfc1bc224d17b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { CacheService } from '@delon/cache';
 
@Component({
  selector: 'app-cache',
  templateUrl: './cache.component.html',
  styles: [],
})
export class CacheComponent implements OnInit {
  KEY = 'user';
 
  constructor(public cache: CacheService, public msg: NzMessageService) {}
 
  ngOnInit() {}
 
  set() {
    this.cache.set(this.KEY, +new Date());
  }
 
  get() {
    this.msg.success(this.cache.getNone(this.KEY));
  }
}