Skip to content

Commit e894099

Browse files
committed
Fjerner invalidering av redis-cache
1 parent d1dd396 commit e894099

File tree

3 files changed

+0
-90
lines changed

3 files changed

+0
-90
lines changed

server/src/cache/page-cache-handler.ts

-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ export default class PageCacheHandler {
5858

5959
public async clear() {
6060
localCache.clear();
61-
return redisCache.clear();
6261
}
6362

6463
public async delete(path: string) {
6564
localCache.delete(pathToCacheKey(path));
66-
return redisCache.delete(path);
6765
}
6866
}

server/src/leader-pod.ts

-53
This file was deleted.

srcCommon/redis.ts

-35
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ interface IRedisCache {
3939
getResponse(key: string): Promise<XpResponseProps | null>;
4040

4141
setResponse(key: string, data: XpResponseProps): Promise<string | null>;
42-
43-
delete(key: string): Promise<number>;
44-
45-
clear(): Promise<string>;
4642
}
4743

4844
class RedisCacheImpl implements IRedisCache {
@@ -125,29 +121,6 @@ class RedisCacheImpl implements IRedisCache {
125121
);
126122
}
127123

128-
public async delete(key: string) {
129-
const responseKey = this.getFullKey(key, this.responseCacheKeyPrefix);
130-
const renderKey = this.getFullKey(key, this.renderCacheKeyPrefix);
131-
132-
logger.info(
133-
`Deleting redis cache entries for ${responseKey} and ${renderKey}`
134-
);
135-
136-
return this.client.del([responseKey, renderKey]).catch((e) => {
137-
logger.error(`Error deleting value for key ${key} - ${e}`);
138-
return 0;
139-
});
140-
}
141-
142-
public async clear() {
143-
logger.info('Clearing redis cache!');
144-
145-
return this.client.flushDb().catch((e) => {
146-
logger.error(`Error flushing database - ${e}`);
147-
return 'error';
148-
});
149-
}
150-
151124
private getFullKey(key: string, keyPrefix: string) {
152125
return `${keyPrefix}:${pathToCacheKey(key)}`;
153126
}
@@ -173,14 +146,6 @@ class RedisCacheDummy implements IRedisCache {
173146
public async setResponse(key: string, data: XpResponseProps) {
174147
return null;
175148
}
176-
177-
public async delete(key: string) {
178-
return 1;
179-
}
180-
181-
public async clear() {
182-
return 'Ok';
183-
}
184149
}
185150

186151
export const RedisCache =

0 commit comments

Comments
 (0)