Skip to main content

Module cache_config

Module cache_config 

Source
Expand description

Global cache configuration

Provides a simple way to enable/disable all caching globally. Caching is disabled by default and must be explicitly enabled via set_caching_enabled(true) or the TYPF_CACHE=1 environment variable.

§Example

use typf_core::cache_config;

// Enable caching (disabled by default)
cache_config::set_caching_enabled(true);

// Check if caching is enabled
if cache_config::is_caching_enabled() {
    println!("Caching is ON");
}

// Disable caching again
cache_config::set_caching_enabled(false);

§Environment Variable

Set TYPF_CACHE=1 to enable caching at startup:

TYPF_CACHE=1 ./my_app

Structs§

ScopedCachingEnabled

Functions§

clear_all_caches
Clear all caches (convenience function)
is_caching_enabled
Check if caching is globally enabled
scoped_caching_enabled
Scoped override for the global caching flag.
set_caching_enabled
Enable or disable caching globally at runtime