1.0.5 • Published 1 year ago

redis-acquire-lock v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

redis-acquire-lock

Straight forward typescript decorator for distributed locking using redis⚡

Using function parameter as key

class UserService {
    @AcquireLock({key: (args) => args[0] + "MX_W", ttl: 2000})
    public createTransaction(userId: string, txType: string) {
        console.log('Function Logic');
    }
}

Using string as key

class UserService {
    @AcquireLock({key: "some_key", ttl: 2000})
    public createTransaction(userId: string, txType: string) {
        console.log('Function Logic');
    }
}

Using function parameter by index

class UserService {
    @AcquireLock({key: [1], ttl: 2000})
    public createTransaction(userId: string, txType: string) {
        console.log('Function Logic');
    }
}
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago