0 0

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)??3

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)什么意思??
谁有相关的帮助文档...

问题补充:讲的是不错...请问你有相关的帮助文档没...就是关于@Cache()的..
给个下载链接啥的..
2010年8月29日 11:35

1个答案 按时间排序 按投票排序

0 0

 从hibernate2.1开始ehcache已经作为hibernate的默认缓存方案(二级缓存方案 sessionfactory级别), 在项目中有针对性的使用缓存将对性能的提升右很大的帮助。

  要使用 Ehcache:需要一下步骤

  一,classpath添加相应的jar(ehcache,commons-logging)

  二,然后在hibernate.cfg.xml中配置

<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
 <property name="cache.use_second_level_cache">true</property>
 <property name="cache.use_query_cache">true</property>

  说明:如果没有配置<property name="cache.use_second_level_cache">true</property>(默认false) 将会产生根据单个id查询的情况(产生很多sql)。

  三,为需要缓存的类添加缓存标示:

  使用mapping文件时需要添加node :

  Java代码  

@Entity 
@Cache(usage=CacheConcurrencyStrategy.READ_ONLY)

  如果使用使用hibernate annoation是使用@Cache(usage=CacheConcurrencyStrategy.)标签,有5种可选的缓存方案:

  1,CacheConcurrencyStrategy.NONE

  不适用,默认

  2.  CacheConcurrencyStrategy.NONSTRICT_READ_WRITE

  更新不频繁几个小时或更长

  3,CacheConcurrencyStrategy.READ_ONLY

  对于不发生改变的数据使用 [size=large][/size]

  4,CacheConcurrencyStrategy.READ_WRITE


  基于时间戳判定机制,,对于数据同步要求严格的情况,使用频繁

  5,CacheConcurrencyStrategy.TRANSACTIONAL

  运行在jta环境种,基于事务

2010年8月29日 18:59

相关推荐

    ZendFramework中文文档

    Cascading Write Operations 10.8.6.1. Notes Regarding Cascading Operations 11. Zend_Debug 11.1. 输出变量的值 (Dumping Variables) 12. Zend_Exception 12.1. 使用“异常” 13. Zend_Feed 13.1. 介绍 ...

    pcf8563_i2c1_r8_ruoge_ov2640通过给RTC驱动增加设备节点读取秒钟成功+直接读取I2C1获取秒钟值20160626_2201.7z

    pcf8563_i2c1_r8_ruoge_ov2640通过给RTC驱动增加设备节点读取秒钟... printf("Usage:\n%s /dev/i2c-x start_addr reg_addr rw[0|1] [write_val]\n", argv[0]); return 0; } fd = open(argv[1], O_RDWR); ...

    DbfDotNet_version_1.0_Source

    When you want to manipulate or cache SQL data When you need to write highly procedural data manipulation routines When you want maximum speed Features Despite its small size DbfDotNet provides a ...

    hibernate 3中的缓存小结

    &lt;cache usage="read-write"/&gt; &lt;id name="id" type="java.lang.Long"&gt; &lt;column name="id" /&gt; &lt;generator class="native" /&gt; &lt;!-- 配置版本号,必须紧跟在id元素后面 --&gt; &lt;version name="version" ...

    cms后台管理

    &lt;cache usage="read-write"/&gt; &lt;id name="id" type="java.lang.Integer" column="id"&gt;&lt;generator class="identity"/&gt;&lt;/id&gt; &lt;property name="title" column="title" type="java.lang.String" not-null="true" /&gt; ...

    IRPTrace2.00.002.zip

    Maximal size of cache for debug messages is 1MB. Some messages can be lost if frequency/size of debug messages is too big. 3.3) IRPTrace does not allow to set hook on IRPDRV driver 4) Known bugs ...

    python3.6.5参考手册 chm

    Performance and resource usage PEP 397: Python Launcher for Windows PEP 3151: Reworking the OS and IO exception hierarchy PEP 380: Syntax for Delegating to a Subgenerator PEP 409: Suppressing ...

    uboott移植实验手册及技术文档

    @ get read to call C functions (for nand_read()) ldr sp, DW_STACK_START @ setup stack pointer mov fp, #0 @ no previous frame, so fp=0 @ copy U-Boot to RAM ldr r0, =TEXT_BASE mov r1, #0x0 mov r2...

    windows版curl

    -C, --cache=on/off (dis)allow server-cached data (normally allowed). --ignore-length ignore `Content-Length' header field. --header=STRING insert STRING among the headers. --proxy-user=USER set...

    Qemu-1.0.1 for windows

    usage: qemu [options] [disk_image] 'disk_image' is a raw hard disk image for IDE hard disk 0 Standard options: -h or -help display this help and exit -version display version information and exit -...

    vxworks_kernel_programmers_guide_6.9

    Inconsistent Cache Mode Support .................................................................. 17 System Viewer Instrumentation Support ...................................................... 17 ...

    The Indispensable PC Hardware Book - rar - part1. (1/7)

    Data bus and write data duplication. I/O address space and the peripherals. I/O addressing. I/O cycles. Registers. Registers overview. Segmenting. General purpose and segment registers. Flags....

    微软内部资料-SQL性能优化2

    Chapters: Evaluating Memory and Cache Usage  Advanced Windows, 4th Edition, Jeffrey Richter, Microsoft Press Related Web Sites  http://ntperformance/ Memory Definitions Memory Definitions ...

    MS-DOS 5.0

    2.12 Bernoulli Cache 2.13 AT&T 6300 Computers 2.14 LANtastic 2.15 Western Digital SCSI Hard-Disk Controllers 2.16 Change CONFIG.SYS File 2.17 Toshiba T1600 and a Hard RAM Disk 3. Installing MS-...

    hadoop_the_definitive_guide_3nd_edition

    Schema on Read Versus Schema on Write 421 Updates, Transactions, and Indexes 422 HiveQL 422 Data Types 424 Operators and Functions 426 Tables 427 Managed Tables and External Tables 427 Partitions and ...

    微软内部资料-SQL性能优化3

    Prior to SQL Server 7.0, REPEATABLE READ and SERIALIZABLE isolation levels were synonymous. There was no way to prevent non-repeatable reads while not preventing phantoms. By default, SQL Server 2000 ...

    qemu-0.13.0(编译过全处理器支持)

    usage: qemu [options] [disk_image] 'disk_image' is a raw hard disk image for IDE hard disk 0 Standard options: -h or -help display this help and exit -version display version information and exit -M...

    squashfs1.3r3.tar.gz

    SQUASHFS 1.3r3 - A squashed read-only filesystem for Linux Copyright 2004 Phillip Lougher (phillip@lougher.demon.co.uk) Released under the GPL licence (version 2 or later). Squashfs is currently ...

    squashfs2.2-r2.tar.gz

    SQUASHFS 2.2 - A squashed read-only filesystem for Linux Copyright 2005 Phillip Lougher (phillip@lougher.demon.co.uk) Released under the GPL licence (version 2 or later). Welcome to Squashfs ...

    lightopc 源代码 opc code

    lightopc源代码: Internal architecture of this server toolkit has ...read-write locks and conditions). In addition to minimal usage of OLE/COM and Win32 API it provides high portability of source code.

Global site tag (gtag.js) - Google Analytics