# SpringBootLock **Repository Path**: skymike/SpringBootLock ## Basic Information - **Project Name**: SpringBootLock - **Description**: SpringBoot的各种锁(乐观锁、悲观锁、分布式锁) - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2020-08-18 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ----- ### 项目中的常用的锁(乐观锁、悲观锁、基于Redis的分布式锁) * #### 乐观锁 **一般通过使用sql来做如添加版本之类的字段来做控制 例:select * from table where version = ?。保证都是一个线程在做更新。** * #### 悲观锁 **锁住操作的资源,在数据库层面保证每次提交或回滚后才能进行下一步操作,例:查询时使用select * from table for update** * #### 分布式锁 **使用Redis实现的分布式锁**