开启缓存 注解驱动
配置逻辑:
    开启(需要指定 缓存管理器)
    缓存管理器(需要指定采用的缓存模板)
    缓存模板(需要指定缓存连接工厂)
    缓存连接工厂(需要配置hostname和port才能连接上)

1.开启缓存注解驱动:

2.缓存管理器

spring-data-redis单机版 配置

3.缓存模板

spring-data-redis单机版 配置

4.缓存连接工厂

spring-data-redis单机版 配置


注意:在使用的时候可能会报 类似 这种错误,原因是存取的键值类型与指定使用的序列化器类型不一致导致,数据转换格式存在问题,把之前存的缓存清掉再调用就好了。

nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (START_OBJECT), expected VALUE_STRING: need JSON String that contains type id (for subtype of java.lang.Object)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-06-12
  • 2021-04-30
  • 2021-09-20
  • 2021-07-27
猜你喜欢
  • 2022-12-23
  • 2022-01-13
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
相关资源
相似解决方案