1.spirng boot+redis 做缓存
1.1
@EnableEurekaClient @EnableCaching @SpringBootApplication public class Application
1.2 get 方法设置
@Override @Transactional @Cacheable(value="staff",key="#id") public Staff getStaffById(Long id)
1.3 update/create/delete方法设置
@Override @Transactional @CachePut(value="staff",key="#staff.sid") public Staff updateStaff(Staff staff)
1.4 配置
spring: redis: host:xxx port: 6379 database: 0 jedis: pool: max-active: 200 max-idle: 500 min-idle: 8 max-wait: 10000 timeout: 5000 cache: type: REDIS cache-names: rediesCache redis: use-key-prefix: false #cache-null-values: true #key-prefix: test time-to-live: 60000
2.面试相关
2.1 redis 缓存穿透,缓存击穿,缓存雪崩
2.2 Redis持久化RDB和AOF区别
2.3 Redis 数据备份与恢复
2.4 集群搭建
2.5 分布式事务