All Projects → jwpttcg66 → Redis Game Transaction

jwpttcg66 / Redis Game Transaction

Licence: apache-2.0
在大型游戏中经常使用分布式,分布式中因为游戏逻辑会经常游戏事务,借助redis特性我们可以实现分布式锁和分布式事务。很多redis集群不支持redis的事务特性。 这个框架用来解决分布式服务器下redis集群事务失效的情况下,基于分布式锁完成分布式事务。支持独占锁,共享锁,读写锁,并且支持事务提交失败情况下的回滚操作,让开发者可以有更多时间侧重游戏逻辑.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Redis Game Transaction

Redis
Type-safe Redis client for Golang
Stars: ✭ 13,117 (+10478.23%)
Mutual labels:  redis, redis-client, redis-cluster
Ioredis
🚀 A robust, performance-focused, and full-featured Redis client for Node.js.
Stars: ✭ 9,754 (+7766.13%)
Mutual labels:  redis, redis-client, redis-cluster
Camellia
camellia framework by netease-im. provider: 1) redis-client; 2) redis-proxy(redis-sentinel/redis-cluster); 3) hbase-client; 4) others
Stars: ✭ 146 (+17.74%)
Mutual labels:  redis, redis-client, redis-cluster
Csredis
.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
Stars: ✭ 1,714 (+1282.26%)
Mutual labels:  redis, redis-client, redis-cluster
Php Redis Client
RedisClient is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0
Stars: ✭ 112 (-9.68%)
Mutual labels:  redis, redis-client, redis-cluster
Cachingframework.redis
Distributed caching based on StackExchange.Redis and Redis. Includes support for tagging and is cluster-compatible.
Stars: ✭ 209 (+68.55%)
Mutual labels:  redis, redis-client, redis-cluster
Redisson
Redisson - Redis Java client with features of In-Memory Data Grid. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Publish / Subscribe, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, MyBatis, RPC, local cache ...
Stars: ✭ 17,972 (+14393.55%)
Mutual labels:  redis, redis-client, redis-cluster
Xredis
Redis C++ client, support the data slice storage, support redis cluster, thread-safe,multi-platform,connection pool, read/write separation.
Stars: ✭ 285 (+129.84%)
Mutual labels:  redis, redis-client, redis-cluster
Lettuce Core
Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
Stars: ✭ 4,319 (+3383.06%)
Mutual labels:  redis, redis-client, redis-cluster
Fastoredis
FastoRedis is a crossplatform Redis GUI management tool.
Stars: ✭ 316 (+154.84%)
Mutual labels:  redis, redis-client, redis-cluster
Quick redis blog
QuickRedis is a free forever Redis Desktop manager. It supports direct connection, sentinel, and cluster mode, supports multiple languages, supports hundreds of millions of keys, and has an amazing UI. Supports both Windows, Mac OS X and Linux platform.
Stars: ✭ 594 (+379.03%)
Mutual labels:  redis, redis-client, redis-cluster
Redis Plus Plus
Redis client written in C++
Stars: ✭ 428 (+245.16%)
Mutual labels:  redis, redis-client, redis-cluster
Redis Py Cluster
Python cluster client for the official redis cluster. Redis 3.0+.
Stars: ✭ 934 (+653.23%)
Mutual labels:  redis, redis-client, redis-cluster
Flycache
一致性哈希的redis分片存储 (Redis sharding by consistent-hashing)
Stars: ✭ 59 (-52.42%)
Mutual labels:  redis, redis-cluster
Php Redis Implementation
Raw wrapper for real Redis fans.
Stars: ✭ 48 (-61.29%)
Mutual labels:  redis, redis-client
Goredis
redis client for golang
Stars: ✭ 59 (-52.42%)
Mutual labels:  redis, redis-client
Tidis
Distributed transactional NoSQL database, Redis protocol compatible using tikv as backend
Stars: ✭ 1,182 (+853.23%)
Mutual labels:  transaction, redis
Docker Redis Cluster
Dockerfile for Redis Cluster (redis 3.0+)
Stars: ✭ 1,035 (+734.68%)
Mutual labels:  redis, redis-cluster
Micropython Stm Lib
A collection of modules and examples for MicroPython running on an STM32F4DISCOVERY board
Stars: ✭ 64 (-48.39%)
Mutual labels:  redis, redis-client
Redisworks
Pythonic Redis Client
Stars: ✭ 78 (-37.1%)
Mutual labels:  redis, redis-client

Redis-分布式-事务

在大型游戏中经常使用分布式,分布式中因为游戏逻辑会经常游戏事务,借助redis特性我们可以实现分布式锁和分布式事务。很多redis集群不支持redis的事务特性。 这个框架用来解决分布式服务器下redis集群事务失效的情况下,基于分布式锁完成分布式事务。支持独占锁,共享锁,读写锁,并且支持事务提交失败情况下的回滚操作,让开发者可以有更多时间侧重游戏逻辑.此框架已经上线手游项目两年,经过百万级DAU验证,稳定运行.

互斥锁使用例子

可参考test下的entity.

  1. 生成事务原因,GameTransactionCauseImpl里面构造.
  2. 生成锁实体,GameTransactionEntityFactoryImpl里面构造TimeMutexEntity.
  3. 提交锁实体跟事务,transactionService.commitTransaction里面提交.
  4. 后去事务提交结果,根据返回值做出判断.

读取锁使用例子

可参考test下的read 可以设置默认是否成功读取到

  1. 生成读取事务原因GameTransactionCause里面已经构造好了.
  2. 生成读取锁实体GameTransactionEntityFactory里面已经构造好了.
  3. 提交读取锁实体跟事务transactionService.commitTransaction里面提交.
  4. 后去事务提交结果 根据返回值做出判断.

标记锁使用例子

可参考test下的lockattchment可以设置默认是否成功读取到

写锁例子如下

  1. 生成事务原因,GameTransactionCauseImpl里面构造.
  2. 生成锁实体,GameTransactionEntityFactoryImpl里面构造.
  3. 生成锁标记内容 GameTransactionEntity对象获取GameTransactionLockInterface锁使用setContent
  4. 提交锁实体跟事务,transactionService.commitTransaction里面提交.
  5. 后去事务提交结果,根据返回值做出判断.

读锁例子如下

  1. 生成读取事务原因GameTransactionCause里面构造.
  2. 生成读取锁实体GameTransactionEntityFactory里面构.
  3. 生成锁标记内容 GameTransactionEntity对象获取GameTransactionLockInterface锁使用setContent
  4. 提交读取锁实体跟事务transactionService.commitTransaction里面提交.
  5. 后去事务提交结果 根据返回值做出判断.

强制写锁使用例子如下

可参考test下的force 当锁存在的情况,延迟锁占用时间。 例子如下

  1. 生成事务原因,GameTransactionCauseImpl里面构造.
  2. 生成锁实体,GameTransactionEntityFactoryImpl里面构造ForceEntity.
  3. 提交锁实体跟事务,transactionService.commitTransaction里面提交.
  4. 后去事务提交结果,根据返回值做出判断.

带时间写锁使用例子如下

参考test下的testlock. 当锁存在的情况,延迟锁占用时间。 例子如下

  1. 生成事务原因,GameTransactionCauseImpl里面构造.
  2. 生成锁实体,GameTransactionEntityFactoryImpl里面构造TestTimeMutexEntity.
  3. 提交锁实体跟事务,transactionService.commitTransaction里面提交.
  4. 后去事务提交结果,根据返回值做出判断.

带时间等待写锁使用例子如下

参考test下的wait.当锁失败的情况下,会尝试每秒检查锁,直到设置的等待时间结束.例子如下

  1. 生成事务原因,GameTransactionCauseImpl里面构造.
  2. 生成锁实体,GameTransactionEntityFactoryImpl里面构造WaitMutexEntity.
  3. 提交锁实体跟事务,transactionService.commitTransaction里面提交.
  4. 后去事务提交结果,根据返回值做出判断.

带事务回滚写锁使用例子如下

参考test下的rollback.当事务提交失败的情况下,根据提交进度进行rollback.例子如下

  1. 生成事务原因,GameTransactionCauseImpl里面构造.
  2. 生成锁实体,GameTransactionEntityFactoryImpl里面构造RollbackMutexEntity.
  3. 提交锁实体跟事务,transactionService.commitTransaction里面提交.
  4. 后去事务提交结果,根据返回值做出判断.

已经集成spring和redis集群

参考test下的spring

代码最后通过maven部署,

  • 作者qq 330258845
  • QQ群310158485
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].