<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          si-store.js基于storage開(kāi)發(fā)緩存庫(kù)

          聯(lián)合創(chuàng)作 · 2023-09-19 03:25

          一個(gè)基于 Web Storage 的存儲(chǔ)庫(kù),提供簡(jiǎn)單的 api 操作,可以設(shè)置緩存時(shí)間。

          示例代碼:

          import store from 'si-store'  // ES6 可以這么寫(xiě)
          
          var store = require('si-store') // commonJs 規(guī)范寫(xiě)法
          
          // 如果是script 標(biāo)簽引入的可以不用管,直接使用store對(duì)象即可
          
          store.set('test1', 'this is value')  // 存儲(chǔ)字符串
          store.set('test2', {
            key: 'this is test'
          })                                   // 也可以存儲(chǔ)對(duì)象
          
          store.get('test1')                   //  獲取存儲(chǔ)的值 this is value
          
          store.remove('test2')                // 刪除key為 test2的存儲(chǔ)

          設(shè)置緩存時(shí)間

          store.set('test', 'test value',  30)   // 設(shè)置過(guò)期時(shí)間在30ms之后
          
          setTimeout(function () {
            store.get('test')                    // null
          }, 31)
          瀏覽 26
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  黄色在线视频网站 | 婷婷久久5月天 | 极品国产在线 | 久久久夜色 | 中文字幕在线播放亚洲 |