!7 cprint CacheAllSnippets { transient SS texts; // snippet ID to uppercase text transient SS titles; // snipppet ID to title start-thread { time "Loaded all snippet texts & titles" { new SS texts; new SS titles; for (virtual CSnippet sn : dm_allSnippets()) { S snippetID = (S) rcall snippetID(sn); texts.put(snippetID, upper((S) rcall text(sn))); titles.put(snippetID, getString title(sn)); } setFields(+texts, +titles); } print("Loaded " + nSnippets(texts) + ", " + nChars(totalStringLength(values(texts)))); } // API // id to uppercase text SS getData() { sleepWhile(() -> texts == null, max := 10.0); ret texts; } SS getTitles() { sleepWhile(() -> titles == null, max := 10.0); ret titles; } }