本例主要演示springboot和redis集成,主要實現的功能點有 - redis分佈式鎖 第一種方案:通過org.springframework.integration.redis.util.RedisLockRegistry進行實現 第二種方案:通過lua腳本和redis實現,詳情查看com.github.lybgeek.redis.util.RedisLockUtils - redis緩存 第一種方案:通過與spring cache集成,@Cacheable、@CachePut 和 @CacheEvict,按不同業務配置不同的過期時間, 其配置可以查看com.github.lybgeek.redis.config.RedisConfig 第二種方案:通過自定義緩存註解 @RedisCache來實現
示例代碼:https://github.com/kaixuanzhang123/springBoot-redis.git