1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

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

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

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

        示例代碼:

        import store from 'si-store'  // ES6 可以這么寫
        
        var store = require('si-store') // commonJs 規(guī)范寫法
        
        // 如果是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è)置過期時(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)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            免费黄色视频网站 | 色天堂下载 | 国产啊v在线 | 真人草逼 | 国产一级淫片a视频免费观看 | 国产宴妇精品久久久久久 | a 在线 | 一级骚逼 | 受被攻做到腿发颤高h视频网站 | 五月丁香花在线视频 |