1 | import Client from './client';
|
2 | import { IRedisKeyOptions } from './types/redis';
|
3 | export default class Transaction {
|
4 | private _client;
|
5 | private _multi;
|
6 | |
7 |
|
8 |
|
9 | constructor(client: Client);
|
10 | /**
|
11 | * Commit a transaction
|
12 | */
|
13 | commit(): Promise<void>;
|
14 | /**
|
15 | * Roll the transaction back
|
16 | */
|
17 | rollback(): void;
|
18 | /**
|
19 | * Is a transaction still open
|
20 | */
|
21 | readonly isOpen: boolean;
|
22 | /**
|
23 | * Set a key value
|
24 | */
|
25 | set(key: string, value: string | number, options?: IRedisKeyOptions): Promise<void>;
|
26 | /**
|
27 | * Increment an integer value
|
28 | */
|
29 | incrby(key: string, value: number, options?: IRedisKeyOptions): Promise<void>;
|
30 | /**
|
31 | * Increment a float value
|
32 | */
|
33 | incrbyfloat(key: string, value: number, options?: IRedisKeyOptions): Promise<void>;
|
34 | /**
|
35 | * Increment an integer value in a hash set
|
36 | */
|
37 | hincrby(key: string, hashKey: string, value: number, options?: IRedisKeyOptions): Promise<void>;
|
38 | /**
|
39 | * Increment a float value in a hash set
|
40 | */
|
41 | hincrbyfloat(key: string, hashKey: string, value: number, options?: IRedisKeyOptions): Promise<void>;
|
42 | /**
|
43 | * Hash map set
|
44 | */
|
45 | hmset(key: string, hash: object, options?: IRedisKeyOptions): Promise<void>;
|
46 | /**
|
47 | * Delete a key
|
48 | */
|
49 | del(key: string): Promise<void>;
|
50 | /**
|
51 | * Add to a set
|
52 | */
|
53 | sadd(key: string, value: string | number, options?: IRedisKeyOptions): Promise<void>;
|
54 | /**
|
55 | * Remove from set
|
56 | */
|
57 | srem(key: string, value: string | number): Promise<void>;
|
58 | /**
|
59 | * Set the expiry in seconds
|
60 | */
|
61 | private _checkExpiry(key, options?);
|
62 | /**
|
63 | * Check to make sure this transaction is still open
|
64 | */
|
65 | private _checkDisposed();
|
66 | }
|