<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>

          Ecache簡單的緩存系統(tǒng)

          聯(lián)合創(chuàng)作 · 2023-09-29 05:57

          ecache

          簡單的緩存系統(tǒng) 純屬學習

          介紹

          ECache -> easy cache 簡單粗暴的命名

          之前自己在做一個項目,服務器需要接入緩存。由于是云主機(屌絲 你懂的),那點內(nèi)存根本不夠再安裝個memcache或者redis之類的緩存服務。當時就用了個最搓的辦法,直接MAP放內(nèi)存了。弊端每次重啟緩存就沒 了。 后面有點空閑時間就想寫個簡單點的緩存(中間也有看下ehcache,代碼挺復雜的,可以學習學習),能持久化就行。然后就寫了這個。 還能用 ^.^

          開始使用

          1. 使用Spring啟動緩存、管理生命周期

          <bean id="cache" class="com.ecache.CacheManager">
              <property name="config">
                  <bean class="com.ecache.Configuration">
                      <property name="root" value="/usr/local/ecache/"/>
                      <property name="space" value="10"/>  <!-- unit GB -->
                  </bean>
              </property>
          </bean>
          1. 代碼中使用

          class CacheTest {
          
            ECache<String, String> cache;
          
            public boolean put(String key, String value) {
              return cache.set(key, value);
            }
          
            public boolean put(String key, String value, long time) {
              return cache.set(key, value, time);
            }
          
            public String get(String key) {
              return cache.get(key);
            }
          
            public boolean remove(String key) {
              return cache.remove(key);
            }
          
            public boolean clear() {
              return cache.clear();
            }
          
          }
          瀏覽 17
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <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>
                  天堂中文在线资源视频 | 亚洲人体视频在线观看 | 天天摸天天操视频 | 污污污污污www网站免费观看 | 无码成人精品久久影院三级 |