mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
change caching and repository api to include system id initializer
This commit is contained in:
@@ -8,11 +8,11 @@ export interface ApiBasedRepositoryCache {
|
||||
etasForStopId?: {
|
||||
[stopId: string]: IEta[],
|
||||
},
|
||||
stopsBySystemId?: {
|
||||
[systemId: string]: IStop[],
|
||||
stopsByStopId?: {
|
||||
[stopId: string]: IStop,
|
||||
},
|
||||
shuttlesByShuttleId?: {
|
||||
[shuttleId: string]: IShuttle[],
|
||||
shuttleByShuttleId?: {
|
||||
[shuttleId: string]: IShuttle,
|
||||
},
|
||||
// To speed things up, implement caches for other data later
|
||||
}
|
||||
@@ -34,6 +34,7 @@ const defaultTtls: ApiBasedRepositoryMillisecondTTLs = {
|
||||
|
||||
export class ApiBasedRepository implements GetterRepository {
|
||||
constructor(
|
||||
private systemId: string,
|
||||
private initialCache: ApiBasedRepositoryCache | undefined = emptyCache,
|
||||
private ttls: ApiBasedRepositoryMillisecondTTLs = defaultTtls,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user