zoukankan      html  css  js  c++  java
  • mybat 中的缓存,多对多

    1.多对多
    // 查询某个老师教的所有学生集合
    Teacher
    ----》List<Student>
    Student
    2.主加载和关联查询
    Dept
    关联对象的加载时机:
    1.直接加载 dept和emps 两条sql都执行
    2.侵入式延迟
    3.深度延迟

    cglib:
    <!--cglib-->
    <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>2.2.2</version>
    </dependency>
    3.缓存 迅雷下载小电影,
    缓存文件
    咱们探讨的缓存在内存中。

    一级缓存:MyBatis中一级默认是内置的,一级缓存不能卸载。

    缓存目的不是为了共享查询结果 。sqlid+select * from dept

    二级缓存的属性
    eviction:缓存中保存对象的清理策略
    FIFO:First in first out 先进先出
    数据结构:队列
    栈:先进后出
    LRU:least Recently used 最近最少使用的对象
    flushInterval:刷新间隔


    Setting this to true will cause the local and 2nd level
    caches to be flushed whenever this statement is
    called. Default: false for select statements.

    将此设置为 true 将导致本地和第二级别
    无论何时此语句都将刷新缓存
    称为.默认值: 选择语句为 true。

    1.flushCache="false" 只对二级缓存有效,一级缓存无效
    2.useCache="true"

    Setting this to true will cause the results of this
    statement to be cached in 2nd level cache. Default:
    true for select statements.

    3.Mybatis内置的二级缓存。第三方EhCache。
    1.ehcache-core 1.2.3
    2.mybatis-ehcache 1.0.0
    3.slf4j 1.7.25
    4.slf-log4j 1.7.25

    5.mybatis 3.4.1

    4.设置二级缓存的两个位置

    ehcache.xml中default节

  • 相关阅读:
    解决GitHub下载速度缓慢的问题
    什么是“个人商业模式”?就是一个人出售自己时间的方式
    phpstudy如何安装ssl证书
    心不动——王阳明最可怕之处
    人间立命王阳明
    计算机视觉数据集
    ECG心电图数据2
    ECG心电图数据1
    梯度下降VS随机梯度下降
    SGD
  • 原文地址:https://www.cnblogs.com/hsa521/p/7678438.html
Copyright © 2011-2022 走看看