- async doesVideoIPViewerExist (ip: string, videoUUID: string) {
- return this.exists(this.generateIPViewerKey(ip, videoUUID))
- }
-
- /* ************ Tracker IP block ************ */
-
- setTrackerBlockIP (ip: string) {
- return this.setValue(this.generateTrackerBlockIPKey(ip), '1', TRACKER_RATE_LIMITS.BLOCK_IP_LIFETIME)
- }
-
- async doesTrackerBlockIPExist (ip: string) {
- return this.exists(this.generateTrackerBlockIPKey(ip))
- }
-
- /* ************ API cache ************ */
-
- async getCachedRoute (req: express.Request) {
- const cached = await this.getObject(this.generateCachedRouteKey(req))
-
- return cached as CachedRoute
- }
-
- setCachedRoute (req: express.Request, body: any, lifetime: number, contentType?: string, statusCode?: number) {
- const cached: CachedRoute = Object.assign(
- {},
- { body: body.toString() },
- (contentType) ? { contentType } : null,
- (statusCode) ? { statusCode: statusCode.toString() } : null
- )
-
- return this.setObject(this.generateCachedRouteKey(req), cached, lifetime)
- }
-