Skip to content

Commit

Permalink
feat(redis-storage): expose redis internals
Browse files Browse the repository at this point in the history
so the client can be shared
  • Loading branch information
stakach committed Apr 11, 2024
1 parent f5a3515 commit 8a460e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: placeos-driver
version: 6.9.21
version: 6.10.0
crystal: ">= 1.0.0"

dependencies:
Expand Down
8 changes: 6 additions & 2 deletions src/placeos-driver/storage/redis-storage.cr
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ module PlaceOS

@@redis : Redis::Client? = nil

protected def self.shared_redis_client
@@redis_lock.synchronize { @@redis ||= new_redis_client }
def self.shared_redis_client : Redis::Client
@@redis || @@redis_lock.synchronize { @@redis = new_redis_client }
end

def self.redis_lock : Mutex
@@redis_lock
end
end
end

0 comments on commit 8a460e7

Please sign in to comment.