Skip to content

Instantly share code, notes, and snippets.

Image doc for Raft in meow

append-entry request-vote server-rules

@gc-garcol
gc-garcol / golang-concurrent-pattern.md
Created September 19, 2024 14:45
golang concurrent pattern
@gc-garcol
gc-garcol / System Design: InMemory Key-Value Store With Transaction.md
Created August 28, 2024 03:55
System Design: InMemory Key-Value Store With Transaction
@gc-garcol
gc-garcol / CompareAndSwap.md
Last active August 22, 2024 08:55
sun.misc.Unsafe
class CASCounter {
    private Unsafe unsafe;
    private volatile long counter = 0;
    private long offset;

    private Unsafe getUnsafe() throws IllegalAccessException, NoSuchFieldException {
        Field f = Unsafe.class.getDeclaredField("theUnsafe");
 f.setAccessible(true);
@gc-garcol
gc-garcol / rabbitmq delay queue.md
Created August 19, 2024 03:48
rabbitmq delay queue

Delay queue

@Service
public class OrderService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

 public void createOrder(Order order) {
@gc-garcol
gc-garcol / js-cache-promise.md
Last active August 17, 2024 15:37
js cache promise

Cache promise

export class FnMemoi {
  promiseCache = {};

  /**
   * 
   * Cache promise to prevent cache stampede
   * 
@gc-garcol
gc-garcol / Structured concurency.md
Created August 14, 2024 02:03
Java - Structured concurency