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

          Uncode-Session集群session共享組件

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

          Uncode-Session

          非常小巧的集群session公享組件,代碼千行以內(nèi),避免使用應用容器插件的多種煩惱。

          功能概述

          1. 非常小巧的集群session共享組件,類似于spring-session。

          2. 總代碼不超過1000行。

          3. 易于使用和擴展。

          配置

          1. web.xml

          <!-- 會話共享過濾器,注意放在其他filter之前 -->
          <filter>
              <filter-name>SessionSharingFilter</filter-name>
              <filter-class>cn.uncode.session.SessionSharingFilter</filter-class>
          </filter>
          <filter-mapping>
              <filter-name>SessionSharingFilter</filter-name>
              <url-pattern>/*</url-pattern>
          </filter-mapping>

          2. 基于Redis的Spring配置

          <!-- 配置Redis緩存池(默認基于redis實現(xiàn),所以只需要配置緩存池就可以了) -->
          <bean id="redisSentinelPool" class="com.ksudi.proxycache.store.redis.RedisSentinelPool">
              <property name="hosts">
                  <list>
                      <value>127.0.0.1:26379</value>
                      <value>127.0.0.2:26379</value>
                  </list>
              </property>
              <property name="auth" value="123456" />
              <property name="maxIdle" value="5" />
              <property name="maxTotal" value="20" />
              <property name="maxWaitMillis" value="10000" />
              <property name="testOnBorrow" value="true" />
          </bean>

          自定義擴展

          1. 自定義實現(xiàn)類

          public class CustomSessionCache implements SessionCache{
          
              @Override
              public void put(String sessionId, SessionMap sessionMap, int timeout) {
          
              }
          
              @Override
              public SessionMap get(String sessionId) {
          
              }
          
              @Override
              public void setMaxInactiveInterval(String sessionId, int interval) {
          
              }
          
              @Override
              public void destroy(String sessionId) {
          
              }
          }

          2. 配置管理器

          <!-- 配置緩存 -->
          <bean id="customSessionCache" class="cn.uncode.session.*.*.CustomSessionCache" />
          
          <!-- 配置會話緩存管理器 -->
          <bean id="sessionCacheManager" class="cn.uncode.session.data.SessionCacheManager">
              <property name="sessionCache" ref="customSessionCache" />
              <!-- 或者使用以下配置,二選一 -->
              <!--
              <property name="beanName" value="sessionCacheManager" />
              -->
          </bean>
          瀏覽 24
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

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

          手機掃一掃分享

          編輯 分享
          舉報
          <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>
                  插插插综合 | 久热最新| 99热天天干 | 久久精品96无码内射 | 日韩操逼 |