b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

缓存: Aspect缓存用于Spring Boot

电脑杂谈  发布时间:2020-03-20 00:09:30  来源:网络整理

spring aop ehcache_ehcache spring_ehcache spring aop

License JDK 1.8

Aspect Cache是​​基于Spring Boot的AOP注释的轻量级缓存. 当前,它支持EHCache和Redis缓存. 数据类型支持POJO,Map和List数据类型. 它还支持自定义缓存键解析,自定义缓存处理方法或对更多缓存方法的扩展支持. 缓存键是使用Spring Expression(SpEL)解析和生成的.

<dependency>
    <artifactId>aspect-cache</artifactId>
    <groupId>com.gosalelab</groupId>
    <version>1.0.0</version>
</dependency>

@EnableAspectCache

com.gosalelab.cache.enable = true

com.gosalelab.cache.provider = eh

com.gosalelab.cache.provider = redis

名称数据的配置项目类型可选值DefaultsRequiredDescription

com.gosalelab.cache

启用

布尔值

true |错误

false

是否启用了外观缓存

com.gosalelab.cache

提供商

ehcache spring aop_ehcache spring_spring aop ehcache

字符串

eh | Redis

默认使用EHCache. 如果要使用redis,可以改用redis.

com.gosalelab.cache

到期时间

3600秒(半小时)

全局缓存时间

com.gosalelab.cache

密钥

字符串

默认

可以通过KeyGenerator接口扩展默认的缓存密钥生成类以使用自定义类. 有关特定的扩展方法,请参见“自定义缓存密钥生成类”说明

com.gosalelab.cache.ehcache

默认缓存名称

字符串

ehcache_cache

EHCache缓存名称

ehcache spring aop_ehcache spring_spring aop ehcache

com.gosalelab.cache.ehcache

可以使用多少磁盘持久性,单位为: MB

com.gosalelab.cache.ehcache

ehcache文件名

字符串

ehcache.xml

EHCache外部配置文件名. 要使用此配置项,请将com.gosalelab.cache.ehcache.use-xml-file-config设置为true.

com.gosalelab.cache.ehcache

max-entries-local-heap

堆资源池中可以存储的条目数

com.gosalelab.cache.ehcache

堆外

非堆资源池的存储大小,单位: MB

com.gosalelab.cache.ehcache

use-xml-file-config

布尔值

true |错误

ehcache spring_ehcache spring aop_spring aop ehcache

false

是否使用xml配置文件

com.gosalelab.cache.redis-cache

缓存中存在哪个redis?

com.gosalelab.cache.redis-cache

字符串

127.0.0.1

redis服务器地址

com.gosalelab.cache.redis-cache

最大怠速

允许的最大空闲对象数量

com.gosalelab.cache.redis-cache

最大总数

最大活动对象数

com.gosalelab.cache.redis-cache

max-wait-millis

spring aop ehcache_ehcache spring_ehcache spring aop

最长等待时间(以毫秒为单位)

com.gosalelab.cache.redis-cache

最小闲置

允许的最小空闲对象

com.gosalelab.cache.redis-cache

密码

字符串

redis服务器登录密码

com.gosalelab.cache.redis-cache

redis服务器连接端口号

com.gosalelab.cache.redis-cache

超时

连接超时,单位: 毫秒

继承KeyGenerator接口并实现getKey方法. 有关详细信息,请参见默认实现方法. 在新类中添加以释,注释名称的命名规则为: 自定义名称+ KeyGeneratorehcache spring aop,例如: defaultKeyGenerator. 然后在配置文件中使用缓存密钥自定义类,如下所示: com.gosalelab.cache.key-generator = xxxInherit CacheProvider接口ehcache spring aop,实现put,get,del方法添加注释: @Component(“ xxxCacheProvider”),注释命名规则为: 自定义名称+ CacheProvider然后在配置中使用自定义缓存提供程序类如下所示的文件: com.gosalelab.cache.provider = xxx在属性文件夹下添加了配置文件在CacheProperties文件初始化中添加了新的配置类向新的初始化配置类中添加了@NestedConfigurationProperty批注重新编译项目文件使用application.properties中的配置项如下: com.gosalelab. 缓存. 新配置. 特定配置项=新配置值

有关详细信息,请参阅演示中的测试类: com.gosalelab.testcase.CacheTest

默认使用SpEL表达式. 有关具体用法,请参阅演示中的测试项目.

添加了英文文档添加了缓存后台管理功能进一步优化了代码


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-145390-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      每日福利
      热点图片
      拼命载入中...