Skip to content

Commit 9f90082

Browse files
author
Felix Robles
committed
add eval for lua scripts
1 parent 47f05ff commit 9f90082

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/datastore/drivers/redis/RedisStore.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,18 @@ export class RedisStore implements Process {
8686

8787
return result
8888
}
89+
90+
public async eval<A, B>(script: string, args: Array<A>): Promise<B> {
91+
if (this.client === undefined) {
92+
throw new Error(
93+
"RedisStore cannot send a command on a closed connection. This usually happens from forgetting to call startup."
94+
)
95+
}
96+
97+
let result: B = await await promisify(
98+
this.client.eval.bind(this.client)
99+
)(script, ...args)
100+
101+
return result
102+
}
89103
}

0 commit comments

Comments
 (0)