WebStorageCache 给local storage添加过期日期

宋望
2023-12-01

webStorageCache

import WebStorageCache from 'web-storage-cache'
var wsCache = new WebStorageCache();
// cache 'wqteam' at 'username', expired in 100 seconds
wsCache.set('username', 'wqteam', {exp : 1});

console.log(wsCache.get('username')) // wqteam
setTimeout(function(){
  console.log(wsCache.get('username'))  // null
},2000)

 

 类似资料: