1.0.5 • Published 3 years ago

redis-acquire-lock v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years 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

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago