spring-data-redis单机版 配置
开启缓存 注解驱动
配置逻辑:
开启(需要指定 缓存管理器)
缓存管理器(需要指定采用的缓存模板)
缓存模板(需要指定缓存连接工厂)
缓存连接工厂(需要配置hostname和port才能连接上)
1.开启缓存注解驱动:
2.缓存管理器
3.缓存模板
4.缓存连接工厂
注意:在使用的时候可能会报 类似 这种错误,原因是存取的键值类型与指定使用的序列化器类型不一致导致,数据转换格式存在问题,把之前存的缓存清掉再调用就好了。
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)