增加redis适配器统一upstash和redis数据层
This commit is contained in:
+7
-3
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable no-console, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { BaseRedisStorage } from './redis-base.db';
|
||||
import { BaseRedisStorage, createRedisClient, createRetryWrapper } from './redis-base.db';
|
||||
import { StandardRedisAdapter } from './redis-adapter';
|
||||
|
||||
export class RedisStorage extends BaseRedisStorage {
|
||||
constructor() {
|
||||
@@ -9,6 +10,9 @@ export class RedisStorage extends BaseRedisStorage {
|
||||
clientName: 'Redis'
|
||||
};
|
||||
const globalSymbol = Symbol.for('__MOONTV_REDIS_CLIENT__');
|
||||
super(config, globalSymbol);
|
||||
const client = createRedisClient(config, globalSymbol);
|
||||
const adapter = new StandardRedisAdapter(client);
|
||||
const withRetry = createRetryWrapper(config.clientName, () => client);
|
||||
super(adapter, withRetry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user