diff options
Diffstat (limited to 'server/lib/redis.ts')
-rw-r--r-- | server/lib/redis.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/server/lib/redis.ts b/server/lib/redis.ts index b284cab8f..2ecff939e 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts | |||
@@ -54,6 +54,18 @@ class Redis { | |||
54 | return this.exists(this.buildViewKey(ip, videoUUID)) | 54 | return this.exists(this.buildViewKey(ip, videoUUID)) |
55 | } | 55 | } |
56 | 56 | ||
57 | listJobs (jobsPrefix: string, state: string, mode: 'alpha', order: 'ASC' | 'DESC', offset: number, count: number) { | ||
58 | return new Promise<string[]>((res, rej) => { | ||
59 | this.client.sort(jobsPrefix + ':jobs:' + state, 'by', mode, order, 'LIMIT', offset.toString(), count.toString(), (err, values) => { | ||
60 | if (err) return rej(err) | ||
61 | |||
62 | |||
63 | |||
64 | return res(values) | ||
65 | }) | ||
66 | }) | ||
67 | } | ||
68 | |||
57 | private getValue (key: string) { | 69 | private getValue (key: string) { |
58 | return new Promise<string>((res, rej) => { | 70 | return new Promise<string>((res, rej) => { |
59 | this.client.get(this.prefix + key, (err, value) => { | 71 | this.client.get(this.prefix + key, (err, value) => { |