Bee V1.11使用Redis二级缓存配置
首先要声明是使用二级缓存, 因为默认二级缓存是关闭的.
bee.osql.cache.useLevelTwo=true
然后是配置,一级缓存,是否还放入二级缓存
#永久和长久缓存默认不放二级缓存,其它一级缓存可通过该配置设置
bee.osql.cache.levelOneTolevelTwo=false
再配置二级缓存的时间.
#二级缓存默认保存时间(秒 second)
bee.osql.cache.levelTwoTimeout=12
剩下的就是bee.osql.cacheRedis.开头的关于redis的配置.
配置好后,要使用redis缓存,还需要启动redis服务
完整配置如下:
#since V1.11
#prototype: 0 not prototype, but faster; 1:prototype,if have NotSerializableException, do not put in cache, slower, but safer; 2 : prototype, but have NotSerializableException,return original
#high safe cache,the javabean(entity) need implements Serializable interface.
bee.osql.cache.prototype=1
bee.osql.cache.useLevelTwo=true
#永久和长久缓存默认不放二级缓存,其它一级缓存可通过该配置设置
bee.osql.cache.levelOneTolevelTwo=false
#二级缓存默认保存时间(秒 second)
bee.osql.cache.levelTwoTimeout=12
bee.osql.cacheRedis.host=localhost
bee.osql.cacheRedis.port=
bee.osql.cacheRedis.password=123456
#, second
bee.osql.cacheRedis.connectionTimeout=10
#Read timed out, second
bee.osql.cacheRedis.soTimeout=3
#bee.osql.cacheRedis.database=
#bee.osql.cacheRedis.clientName=
#bee.osql.cacheRedis.ssl=
#cache=======================end

本文介绍了BeeV1.11中如何启用和配置Redis作为二级缓存,包括设置缓存使用、是否将一级缓存放入二级缓存、二级缓存的超时时间,以及具体的Redis连接参数。详细步骤和配置示例帮助读者理解如何实现高效的缓存管理。
2554

被折叠的 条评论
为什么被折叠?



