From 7c099b7baaeb5755614e0152cb9dade7556e57ab Mon Sep 17 00:00:00 2001 From: Benedictus Alvian Sofjan Date: Thu, 6 Aug 2026 11:46:57 +0100 Subject: [PATCH 1/2] Enable Gateway to Request Cache Asynchonously --- code/common/getter.q | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 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..73ebde7e8 --- /dev/null +++ b/code/common/getter.q @@ -0,0 +1,29 @@ +// 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; +} + +requestnewcache:{[cachename; args] + cachename:"MyFirstCache"; + args:`cache1`cache2!(`a`b`c! 1 2 3;`d`e`f!4 5 6); + processname:"AsyncCache"; + maincache:` sv (hsym `$cacheconfig`cacheRootDir),(`$cachename),`$processname, "_", string .z.P; + (` sv maincache,`args) set args +} + +\d . \ No newline at end of file From 7c7a06f22e6ac1d27f7aafdfb2f266ed27ed9fa0 Mon Sep 17 00:00:00 2001 From: Benedictus Alvian Sofjan Date: Wed, 19 Aug 2026 09:20:39 +0100 Subject: [PATCH 2/2] Update getter.q --- code/common/getter.q | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/common/getter.q b/code/common/getter.q index 73ebde7e8..978387a8f 100644 --- a/code/common/getter.q +++ b/code/common/getter.q @@ -3,26 +3,26 @@ \d .getter // Get cache from disk -getcachefromdisk:{[filePath] get hsym filePath} +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"; + cachename:"myfirstcache"; caches:key cacheconfig`componentCaches; - cachefilepaths: ` sv' ((hsym `$cacheconfig`cacheRootDir),2#`$cachename),/:`$(string caches),\:"/data"; + cachefilepaths: ` sv' ((hsym `$cacheconfig`cacherootdir),2#`$cachename),/:`$(string caches),\:"/data"; cachesdata:getcachefromdisk each cachefilepaths; cachevarnames:` sv' `.anycache.cache,/:caches; cachevarnames set' cachesdata; } requestnewcache:{[cachename; args] - cachename:"MyFirstCache"; + cachename:"myfirstcache"; args:`cache1`cache2!(`a`b`c! 1 2 3;`d`e`f!4 5 6); processname:"AsyncCache"; - maincache:` sv (hsym `$cacheconfig`cacheRootDir),(`$cachename),`$processname, "_", string .z.P; + maincache:` sv (hsym `$cacheconfig`cacherootdir),(`$cachename),`$processname, "_", string .z.P; (` sv maincache,`args) set args }