zoukankan      html  css  js  c++  java
  • cache

    二级缓存

    <mapper namespace="com.abc.dao.IStudentDao">
        
        <!-- 开启二级缓存 -->
        <cache size="512" eviction="LRU" flushInterval="100000"/>
    
        <insert id="insertStudent" flushCache="false">
            insert into student(name,age,score) values(#{name}, #{age}, #{score})
        </insert>
        
        <delete id="deleteById">
            delete from student where id=#{xxx}
        </delete>
        
        <update id="updateStudent">
            update student set name=#{name}, age=#{age}, score=#{score} where id=#{id}
        </update>
        
        <select id="selectStudentById" resultType="Student">
            select id,name,age,score from student where id=#{ooo}
        </select>
        
        <select id="selectStudentById2" resultType="Student">
            select id,name,age,score from student where id=#{ooo}
        </select>
        
    </mapper>
    <mapper namespace="com.abc.dao.IStudentDao">
        
        <!-- 开启二级缓存 -->
        <cache type="org.mybatis.caches.ehcache.EhcacheCache">
            <property name="maxElementsInMemory" value="1000"/>
            <property name="timeToLiveSeconds" value="240"/>
        </cache>
    
        <insert id="insertStudent" flushCache="false">
            insert into student(name,age,score) values(#{name}, #{age}, #{score})
        </insert>
        
        <delete id="deleteById">
            delete from student where id=#{xxx}
        </delete>
        
        <update id="updateStudent">
            update student set name=#{name}, age=#{age}, score=#{score} where id=#{id}
        </update>
        
        <select id="selectStudentById" resultType="Student" useCache="false">
            select id,name,age,score from student where id=#{ooo}
        </select>
        
        <select id="selectStudentById2" resultType="Student">
            select id,name,age,score from student where id=#{ooo}
        </select>
        
    </mapper>
  • 相关阅读:
    (7)排序之归并排序
    (5)排序之简单选择排序
    (4)排序之希尔排序
    (3)排序之直接插入排序
    (2)排序之快速排序
    (1)排序之冒泡排序
    Python学习
    centos下docker网络桥接
    docker下搭建gitlab
    centos版本7以上网卡名修改
  • 原文地址:https://www.cnblogs.com/csslcww/p/9912403.html
Copyright © 2011-2022 走看看