Skip to content
Open
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
29 changes: 29 additions & 0 deletions code/common/getter.q
Original file line number Diff line number Diff line change
@@ -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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is cacheconfig expected to look like? It's probably worthwhile having a template json file so developers know what should be in the file


loadcaches:{
Comment thread
bsofjan marked this conversation as resolved.
cachename:"myfirstcache";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cachename as a parameter?

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]
Comment thread
bsofjan marked this conversation as resolved.
cachename:"myfirstcache";
args:`cache1`cache2!(`a`b`c! 1 2 3;`d`e`f!4 5 6);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you're overwriting the args and cachename parameters here - if you want to give examples then use comments in the same format as the rest of the TorQ codebase to show what the parameters should look like

processname:"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.

should processname be a parameter? Should the value be in lower case instead of CamelCase?

maincache:` sv (hsym `$cacheconfig`cacherootdir),(`$cachename),`$processname, "_", string .z.P;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

related to the above - not sure what this is doing without knowing what should be inside cacheconfig

(` sv maincache,`args) set args
}

\d .