From d2f940233b242ca8254d614a8f7dc494f048f669 Mon Sep 17 00:00:00 2001 From: Benedictus Alvian Sofjan Date: Wed, 29 Jul 2026 09:17:45 +0100 Subject: [PATCH] Enable Gateway to Read Cache --- code/common/getter.q | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 code/common/getter.q diff --git a/code/common/getter.q b/code/common/getter.q new file mode 100644 index 000000000..a39200fe6 --- /dev/null +++ b/code/common/getter.q @@ -0,0 +1,21 @@ +// Bootstrap script that will enable an existing process to load in cache getter functionalities. + +\d .getter + +// Get cache from disk +getcachefromdisk:{[filePath] get hsym filePath} + +// Get location of cache config and load it in. +cacheconfiglocation:.proc.getconfigfile["cacheconfig.json"]; +cacheconfig:.j.k raze read0 hsym first cacheconfiglocation; + +loadcaches:{ + cachename:"MyFirstCache"; + caches:key cacheconfig`componentCaches; + cachefilepaths: ` sv' ((hsym `$cacheconfig`cacheRootDir),2#`$cachename),/:`$(string caches),\:"/data"; + cachesdata:getcachefromdisk each cachefilepaths; + cachevarnames:` sv' `.anycache.cache,/:caches; + cachevarnames set' cachesdata; +} + +\d . \ No newline at end of file