Talk about locks all the way
Synchronized
I. Use
Modifier class: instance method, static method, code block;
Instance method: Lock object is the current instance object:
public synchronized void sayHello(){
System.out.println("Hello World");
}
Static method: Lock object is the current class Class object:
public static synchronized void sayHello(){
System.out.print ...
Posted by nick314 on Wed, 22 Dec 2021 07:31:22 +0100
Implementing distributed locks with Go + Redis
Why do I need distributed locksUser ordersLock uid to prevent repeated orders.Inventory deductionLock inventory to prevent oversold.Balance deductionLock the account to prevent concurrent operations.When sharing the same resource in a distributed system, distributed locks are often needed to ensure the consistency of change resources.Distribute ...
Posted by Solarpitch on Wed, 15 Dec 2021 04:29:34 +0100
Application of cache and distributed lock
Application of cache and distributed lock
1. Cache application
Cache usage scenario:
In order to improve the system performance, we usually put some data into the cache to speed up access, while the database only undertakes the data dropping work
So what data is suitable for caching?
The requirements for immediacy and data consistency are n ...
Posted by billynastie2007 on Mon, 22 Nov 2021 15:33:09 +0100