mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
849 B
25 lines
849 B
import { CacheService } from '@ghostfolio/api/app/cache/cache.service';
|
|
import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service';
|
|
import type { RequestWithUser } from '@ghostfolio/common/types';
|
|
import { Controller, Inject, Post, UseGuards } from '@nestjs/common';
|
|
import { REQUEST } from '@nestjs/core';
|
|
import { AuthGuard } from '@nestjs/passport';
|
|
|
|
@Controller('cache')
|
|
export class CacheController {
|
|
public constructor(
|
|
private readonly cacheService: CacheService,
|
|
private readonly redisCacheService: RedisCacheService,
|
|
@Inject(REQUEST) private readonly request: RequestWithUser
|
|
) {
|
|
this.redisCacheService.reset();
|
|
}
|
|
|
|
@Post('flush')
|
|
@UseGuards(AuthGuard('jwt'))
|
|
public async flushCache(): Promise<void> {
|
|
this.redisCacheService.reset();
|
|
|
|
return this.cacheService.flush();
|
|
}
|
|
}
|
|
|