mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 05:27:00 +03:00
Rename config for clientCacheSize
This commit is contained in:
@@ -167,7 +167,7 @@ addDefaults(config, {
|
|||||||
stopWritingAfterResponseTime: 50,
|
stopWritingAfterResponseTime: 50,
|
||||||
responseTimePause: 1000,
|
responseTimePause: 1000,
|
||||||
disableHashCache: false,
|
disableHashCache: false,
|
||||||
clientCacheLength: 2000
|
clientCacheSize: 2000
|
||||||
},
|
},
|
||||||
redisRead: {
|
redisRead: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ interface RedisConfig extends redis.RedisClientOptions {
|
|||||||
stopWritingAfterResponseTime: number;
|
stopWritingAfterResponseTime: number;
|
||||||
responseTimePause: number;
|
responseTimePause: number;
|
||||||
disableHashCache: boolean;
|
disableHashCache: boolean;
|
||||||
clientCacheLength: number;
|
clientCacheSize: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RedisReadOnlyConfig extends redis.RedisClientOptions {
|
interface RedisReadOnlyConfig extends redis.RedisClientOptions {
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ const writeResponseTime: number[] = [];
|
|||||||
let lastResponseTimeLimit = 0;
|
let lastResponseTimeLimit = 0;
|
||||||
const maxStoredTimes = 200;
|
const maxStoredTimes = 200;
|
||||||
|
|
||||||
const cache = config.redis.clientCacheLength ? new LRUCache<RedisCommandArgument, string>({
|
const cache = config.redis.clientCacheSize ? new LRUCache<RedisCommandArgument, string>({
|
||||||
maxSize: config.redis.clientCacheLength,
|
maxSize: config.redis.clientCacheSize,
|
||||||
sizeCalculation: (value) => value.length
|
sizeCalculation: (value) => value.length
|
||||||
}) : null;
|
}) : null;
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ if (config.redis?.enabled) {
|
|||||||
void cacheClient.connect();
|
void cacheClient.connect();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config.redis.clientCacheLength) {
|
if (config.redis.clientCacheSize) {
|
||||||
createCacheClient();
|
createCacheClient();
|
||||||
|
|
||||||
client.on("ready", () => {
|
client.on("ready", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user