shop++的缓存配置
来源:互联网 发布:淘宝卖家活动报名入口 编辑:程序博客网 时间:2024/06/14 07:14
shop++的缓存配置
默认的shop++开源版本只有 部分查询缓存。
shop++应用可采用oscache作为Hibernate的缓存配置,为常见的缓存策略应用。
实体缓存(entity cache)、实体集合缓存(collectioncache)和查询缓存(query cache)通过Java annotations实现,所以更改缓存后需要重新编译发布。
1.1. 缓存的配置文件
1.1.1. applicatonContext.xml
以下两处设置为true
[font="][font="]
引用
[font="]<!-- 是否开启二级缓存[font="]-->[font="][font="]hibernate.cache.use_second_level_cache=true
[font="][font="]<!-- 是否开启查询缓存[font="]-->[font="][font="]hibernate.cache.use_query_cache=true
1.1.2. oscache.properties
依据应用服务器的内存设置缓存对象的个数,默认为10000
cache.capacity=10000
1.2. 缓存种类
1.2.1. 实体缓存
针对不同实体的作用,选择合适的缓存策略。
例如Product、ProductAttribute选择READ_WRITE
引用
@Entity
@Searchable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
publicclassProduct extendsBaseEntity {
ProductCategory、Navigation选择NONSTRICT_READ_WRITE
引用
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
publicclassNavigationextendsBaseEntity {
1.2.2. 实体的集合缓存
例如,配置Product实体的规格参数属性的缓存。
引用
@CollectionOfElements
@MapKey(targetElement= ProductAttribute.class)
@LazyCollection(LazyCollectionOption.FALSE)
@Cascade(value= { CascadeType.DELETE})
@Cache(usage= CacheConcurrencyStrategy.READ_WRITE)
publicMap<ProductAttribute,String> getProductAttributeMapSto() {
returnproductAttributeMapStore;
}
1.2.3. 查询缓存
默认的shop++开源版本
例如,在ProductCategoryServiceImpl配置查询缓存。
引用
@Cacheable(modelId= "caching")
publicList getParentProductCategoryList(ProductCategoryproductCategory) {
- shop++的缓存配置
- shop++的缓存配置
- SHOP++页面缓存的配置方法
- SHOP++管理权限的配置方法
- shop++配置新的主题
- Pet Shop 4.0的缓存机制
- shop++内存溢出配置
- shop
- Shop++
- shop
- 数据库缓存的配置
- 缓存的配置
- 报表缓存的配置
- nginx的缓存配置
- hibernate的缓存配置
- EHCache缓存的配置
- superset的缓存配置
- 尝试玩玩Houdini的shop
- MFC获取窗体在设备上的相关信息,位置,设备信息等
- vc6.0内存泄露
- RHEL5.1 tftp和nfs安装
- Oracle的外连接符号(+)
- jQuery乱谈(七)
- shop++的缓存配置
- 构设计:生产者/消费者模式[1]:如何确定数据单元?
- 架构设计:生产者/消费者模式[2]:队列缓冲区
- FZU 2019 Mountain Number
- Android - 自动禁用布局里的所有子控件
- 多机调度问题
- 架构设计:生产者/消费者模式[3]:环形缓冲区
- 请求管道与19个标准事件
- c++ boost库简介