MCPcopy Create free account
hub / github.com/Recordscript/recordscript / read

Method read

libs/hbb_common/src/config.rs:1597–1605  ·  view source on GitHub ↗
(key: &str)

Source from the content-addressed store, hash-verified

1595
1596impl UserDefaultConfig {
1597 fn read(key: &str) -> String {
1598 let mut cfg = USER_DEFAULT_CONFIG.write().unwrap();
1599 // we do so, because default config may changed in another process, but we don't sync it
1600 // but no need to read every time, give a small interval to avoid too many redundant read waste
1601 if cfg.1.elapsed() > Duration::from_secs(1) {
1602 *cfg = (Self::load(), Instant::now());
1603 }
1604 cfg.0.get(key)
1605 }
1606
1607 pub fn load() -> UserDefaultConfig {
1608 Config::load_::<UserDefaultConfig>("_default")

Callers 15

getMethod · 0.45
get_homeMethod · 0.45
pathMethod · 0.45
get_rendezvous_serverMethod · 0.45
get_nat_typeMethod · 0.45
get_serialMethod · 0.45
get_key_confirmedMethod · 0.45
get_idMethod · 0.45
get_id_orMethod · 0.45
get_optionsMethod · 0.45
get_optionMethod · 0.45

Calls 3

loadFunction · 0.85
writeMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected