From 86373b4cb83cecb042c49c1d432ade3dcef244e3 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 16 Apr 2024 14:45:04 +0200 Subject: [PATCH] Add cache to velopark entries --- src/Logic/Web/LinkedDataLoader.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Logic/Web/LinkedDataLoader.ts b/src/Logic/Web/LinkedDataLoader.ts index a5b21d63d..41c1e661d 100644 --- a/src/Logic/Web/LinkedDataLoader.ts +++ b/src/Logic/Web/LinkedDataLoader.ts @@ -641,12 +641,17 @@ export default class LinkedDataLoader { return results } + private static veloparkCache : Record = {} + /** * Fetches all data relevant to velopark. * The id will be saved as `ref:velopark` * @param url */ public static async fetchVeloparkEntry(url: string): Promise { + if(this.veloparkCache[url]){ + return this.veloparkCache[url] + } const withProxyUrl = Constants.linkedDataProxy.replace("{url}", encodeURIComponent(url)) const optionalPaths: Record> = { "schema:interactionService": { @@ -702,6 +707,7 @@ export default class LinkedDataLoader { p["ref:velopark"] = [section] patched.push(LinkedDataLoader.asGeojson(p)) } + this.veloparkCache[url] = patched return patched } }