如不雅须要自定义序列化实现,只要实现 RedisSerializer 接口去实现即可,然后在应用 RedisTemplate.setValueSerializer 办法去设置你实现的序列化实现。
- package org.spring.springboot.service.impl;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.spring.springboot.dao.CityDao;
- import org.spring.springboot.domain.City;
- import org.spring.springboot.service.CityService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.redis.core.RedisTemplate;
- import org.springframework.data.redis.core.StringRedisTemplate;
- import org.springframework.data.redis.core.ValueOperations;
- import org.springframework.stereotype.Service;
- import java.util.List;
- import java.util.concurrent.TimeUnit;
- /**
- * 城市营业逻辑实现类
- * <p>
- * Created by bysocket on 07/02/2017.
- */
- @Service
- public class CityServiceImpl implements CityService {
- private static final Logger LOGGER = LoggerFactory.getLogger(CityServiceImpl.class);
- @Autowired
- private CityDao cityDao;
- @Autowired
- private RedisTemplate redisTemplate;
- /**
- * 获取城市逻辑:
- * 如不雅缓存存在,大年夜缓存中获取城市信息
- * 如不雅缓存不存在,大年夜 DB 中获取城市信息,然后插入缓存
- */
- public
推荐阅读
Facebook的交互式神经网络可视化系统ActiVis,打开神经网络的“黑盒子”
之前很多媒体在热烈评论辩论神经收集的“黑盒子”(black box)问题。复杂的模型处理猜测性工作负载时表示优胜,然则说到回溯体系是若何得出最终结不雅的,根本没有一种清楚的办>>>详细阅读
本文标题:Spring Boot 整合 Redis 实现缓存操作
地址:http://www.17bianji.com/lsqh/34801.html
1/2 1