fixed cache keys
This commit is contained in:
parent
db3aa9c330
commit
19dfda2392
13 changed files with 286 additions and 221 deletions
|
|
@ -176,8 +176,8 @@ export class ProxyManager {
|
|||
this.proxies = proxies;
|
||||
this.lastUpdate = new Date();
|
||||
|
||||
// Store to cache
|
||||
await this.cache.set('active-proxies', proxies);
|
||||
// Store to cache (keys will be prefixed with cache:proxy: automatically)
|
||||
await this.cache.set('active', proxies);
|
||||
await this.cache.set('last-update', this.lastUpdate.toISOString());
|
||||
|
||||
const workingCount = proxies.filter(p => p.isWorking !== false).length;
|
||||
|
|
@ -234,7 +234,7 @@ export class ProxyManager {
|
|||
this.proxies = [];
|
||||
this.lastUpdate = null;
|
||||
|
||||
await this.cache.del('active-proxies');
|
||||
await this.cache.del('active');
|
||||
await this.cache.del('last-update');
|
||||
|
||||
this.logger.info('Cleared all proxies');
|
||||
|
|
@ -252,7 +252,7 @@ export class ProxyManager {
|
|||
*/
|
||||
private async loadFromCache(): Promise<void> {
|
||||
try {
|
||||
const cachedProxies = await this.cache.get<ProxyInfo[]>('active-proxies');
|
||||
const cachedProxies = await this.cache.get<ProxyInfo[]>('active');
|
||||
const lastUpdateStr = await this.cache.get<string>('last-update');
|
||||
|
||||
if (cachedProxies && Array.isArray(cachedProxies)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue