哪些数据适合放入二级缓存中?

PHPz
Release: 2020-09-05 11:57:39
Original
2213 people have browsed it

哪些数据适合放入二级缓存中?

什么是二级缓存?

二级缓存是一级缓存的缓冲器,一级缓存用于暂时存储并向CPU递送各类运算指令。二级缓存的作用是存储那些CPU处理时需要用到、一级缓存又无法存储的数据。

在程序中的表现形式:一级缓存就是session级别的缓存,因为hibernate中的session存有数据的备份,同一个session再次访问该数据时是首先通过该备份去查找的,如果查找不到的话,才会去硬盘或者数据库当中查找的;

二级缓存是sessionFactory级别的缓存,在一个数据库中只有一个sessionFactory而次缓存即为所有session缓存的共同体,包含所有一级缓存中的对象,如果二级缓存打开的话,一级缓存查找数据的时候,会首先去二级缓存当中查找的。

哪些数据适合放入二级缓存中?

适合存放在二级缓存中的数据:

很少被修改,不是很重要的数据,允许出现偶尔的并发问题 

不适合放入二级缓存中的数据:

经常被修改,财务数据,绝对不允许出现并发问题,与其他应用数据共享的数据

更多相关知识,请访问 PHP中文网!!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!