From f6e62cc5e22e5d02ce30a3710972b7ccbf2c2a60 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 7 Jan 2025 14:46:24 -0800 Subject: [PATCH] add cache initialization --- src/repositories/ApiBasedRepository.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/repositories/ApiBasedRepository.ts b/src/repositories/ApiBasedRepository.ts index 4c9a1c0..375b6c4 100644 --- a/src/repositories/ApiBasedRepository.ts +++ b/src/repositories/ApiBasedRepository.ts @@ -14,6 +14,19 @@ interface ApiBasedRepositoryCache { } export class ApiBasedRepository implements GetterRepository { + private cache: ApiBasedRepositoryCache; + + constructor(initialCache: ApiBasedRepositoryCache | undefined = undefined) { + if (initialCache) { + this.cache = initialCache; + } else { + this.cache = { + etasForShuttleId: {}, + etasForStopId: {}, + } + } + } + public async getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise { return null; }