I want to call readFromMap
without instantiating the HelperClass
.
So I wanted to check if I can call readIntoMapFromDataStore
at (some think like) class-load?
So that map is always initialized before calling readFromMap
?
Initialize static map
class HelperClass {
static map<string, string> cache;
static string readFromMap(string key) {
return cache.at(key);
}
static void readIntoMapFromDataStore() {
//read contents into cache from datastore
}
}
How to initialize before calling readFromMap
?