From 64f642f3a6435841bba71b5fdbe0d59a426f6665 Mon Sep 17 00:00:00 2001 From: Benedictus Alvian Sofjan Date: Thu, 28 May 2026 18:01:25 +0100 Subject: [PATCH 1/2] Add cacheConfig, setter process, getter script --- code/common/getter.q | 3 +++ code/processes/setter.q | 7 +++++++ config/cacheConfig.json | 0 3 files changed, 10 insertions(+) create mode 100644 code/common/getter.q create mode 100644 code/processes/setter.q create mode 100644 config/cacheConfig.json diff --git a/code/common/getter.q b/code/common/getter.q new file mode 100644 index 000000000..b6f2a63ae --- /dev/null +++ b/code/common/getter.q @@ -0,0 +1,3 @@ +\d .getter + +getCacheFromDisk:{[filePath] load hsym filePath} \ No newline at end of file diff --git a/code/processes/setter.q b/code/processes/setter.q new file mode 100644 index 000000000..e1592dedc --- /dev/null +++ b/code/processes/setter.q @@ -0,0 +1,7 @@ +\d .setter + +saveCacheDowntoDisk:{[data;filePath] (hsym filePath) set data }; +cacheConfigLocation:.proc.getconfigfile["cacheConfig.json"]; / - location of the cache config configuration file +cacheConfig:.j.k raze read0 hsym first cacheConfigLocation; + +\d . diff --git a/config/cacheConfig.json b/config/cacheConfig.json new file mode 100644 index 000000000..e69de29bb From fc1f07f5c641d04aeb423cc417b2ccb6efa579d5 Mon Sep 17 00:00:00 2001 From: Benedictus Alvian Sofjan Date: Mon, 22 Jun 2026 08:52:34 +0100 Subject: [PATCH 2/2] Standardising Changes and Add Default json Config --- code/common/getter.q | 7 ++++++- code/processes/setter.q | 11 ++++++++--- config/cacheConfig.json | 0 config/cacheconfig.json | 21 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) delete mode 100644 config/cacheConfig.json create mode 100644 config/cacheconfig.json diff --git a/code/common/getter.q b/code/common/getter.q index b6f2a63ae..77e8bd6d4 100644 --- a/code/common/getter.q +++ b/code/common/getter.q @@ -1,3 +1,8 @@ +// Bootstrap script that will enable an existing process to load in cache getter functionalities. + \d .getter -getCacheFromDisk:{[filePath] load hsym filePath} \ No newline at end of file +// Get cache from disk +getcachefromdisk:{[filePath] load hsym filePath} + +\d . diff --git a/code/processes/setter.q b/code/processes/setter.q index e1592dedc..261993c7c 100644 --- a/code/processes/setter.q +++ b/code/processes/setter.q @@ -1,7 +1,12 @@ +// Setter process to set cache to disk + \d .setter -saveCacheDowntoDisk:{[data;filePath] (hsym filePath) set data }; -cacheConfigLocation:.proc.getconfigfile["cacheConfig.json"]; / - location of the cache config configuration file -cacheConfig:.j.k raze read0 hsym first cacheConfigLocation; +// Save cache down to disk +savecachedowntodisk:{[data;filePath] (hsym filePath) set data }; + +// Get location of cache config and load it in. +cacheconfiglocation:.proc.getconfigfile["cacheconfig.json"]; +cacheconfig:.j.k raze read0 hsym first cacheconfiglocation; \d . diff --git a/config/cacheConfig.json b/config/cacheConfig.json deleted file mode 100644 index e69de29bb..000000000 diff --git a/config/cacheconfig.json b/config/cacheconfig.json new file mode 100644 index 000000000..1eba4dcd4 --- /dev/null +++ b/config/cacheconfig.json @@ -0,0 +1,21 @@ +{ + "cacheRootDir": "/opt/anycache/", + "componentCaches":{ + "cache1": { + "analytic": "analytic1", + "dataSource": "connection1" + }, + "cache2": { + "analytic": "analytic2", + "dataSource": "connection2" + } + }, + "getter":{ + "interval": "0D00:05" + }, + "setter":{ + "mode": "timer", + "interval": "0D00:30", + "compression": "16 3 0" + } +} \ No newline at end of file