diff --git a/README.md b/README.md index 136c150..06ffb7c 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,6 @@ In its most elegant form, you can pass a simple closure to the `synchronized` fu $ticketNumber = synchronized(fn () => Cache::increment('ticket-number')); ``` -Since `Cache::increment` is not an atomic operation, you would normally run the risk of returning identical numbers on parallel server requests. But when we wrap it in `synchronized`, we ensure the `Cache::increment` never runs in parallel. - ## How does it work? Internally, `synchronized` generates an *Atomic Lock Key* (which is simply a hashed string) based on the location of and variables in the callable. This is just like how the ✨magic✨ `once` function works. @@ -72,4 +70,4 @@ use App\Models\TicketDispenser; $dispenser = TicketDispenser::find(Request::get('ticket-dispenser-id')); $ticket = synchronized(fn () => $dispenser->nextTicket(), $dispenser); -``` \ No newline at end of file +```