Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions code/common/getter.q
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Bootstrap script that will enable an existing process to load in cache getter functionalities.

\d .getter

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be .anycache.getter?


// Get cache from disk
getcachefromdisk:{[filepath] get hsym filepath}

// Get location of cache config and load it in.
cacheconfiglocation:.proc.getconfigfile["cacheconfig.json"];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a function of some sort - takes a config filename, if empty load the default

cacheconfig:.j.k raze read0 hsym first cacheconfiglocation;
Comment thread
bsofjan marked this conversation as resolved.
cachename: cacheconfig`cachename;
asyncprocessname: cacheconfig`asyncprocessname;

loadcaches:{
Comment thread
bsofjan marked this conversation as resolved.
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;
}

// Example of args: `cache1`cache2!(`a`b`c! 1 2 3;`d`e`f!4 5 6)
requestnewcache:{[args]
maincache:` sv (hsym `$cacheconfig`cacherootdir),(`$cachename),`$asyncprocessname, "_", string .z.P;
(` sv maincache,`args) set args
}

\d .
23 changes: 23 additions & 0 deletions config/cacheconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"cacherootdir": "opt/anycache",
"cachename": "MyFirstCache",
"asyncprocessname": "AsyncCache",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CamelCase - check other config files in TorQ, if they use CamelCase it's okay but if not then change to match the convention

"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"
}
}