Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pauluswi authored Nov 16, 2024
1 parent 9cd50c7 commit 05a8bfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ This approach uses Golang's `sync.Mutex` to enforce mutual exclusion within a si
- Each transaction is processed in a separate goroutine using the go keyword.
- A ```sync.WaitGroup``` ensures the main function waits for all transactions to complete.
- The sync.Mutex ensures that only one goroutine can update an account's balance at a time.
- Simulates acquiring and releasing locks without connecting to a real Redis server.

```go
// Account represents a bank account
Expand Down Expand Up @@ -136,7 +135,8 @@ This approach uses Redis to simulate distributed locking. Each critical section
- Each transaction is processed in a separate goroutine using the go keyword.
- A ```sync.WaitGroup``` ensures the main function waits for all transactions to complete.
- Redis SET with NX ensures that the operation is atomic, meaning the lock is created and has a TTL in a single operation.

- Simulates acquiring and releasing locks without connecting to a real Redis server.

```go
// MockRedis simulates a Redis client with basic lock functionality
type MockRedis struct {
Expand Down

0 comments on commit 05a8bfb

Please sign in to comment.