Skip to main content

clear_string_cache

Function clear_string_cache 

Source
pub fn clear_string_cache()
Expand description

Clear the string cache for the current thread

This can be useful for testing or when you know a set of strings will no longer be needed. The cache will be automatically cleared when it reaches MAX_CACHE_SIZE entries.

ยงExample

use hedl_json::string_cache::{intern_string, clear_string_cache, string_cache_stats};

intern_string("test");
assert_eq!(string_cache_stats().entries, 1);

clear_string_cache();
assert_eq!(string_cache_stats().entries, 0);