From 7c099b7baaeb5755614e0152cb9dade7556e57ab Mon Sep 17 00:00:00 2001 From: Benedictus Alvian Sofjan Date: Thu, 6 Aug 2026 11:46:57 +0100 Subject: [PATCH] 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