Cache
The Cache commands provide a persistent key-value store across package executions.
set_cache
Stores a cache entry identified by cache_id.
set_cache(cache_id, data, options);
Arguments :
- cache_id is a unique identifier for the cache data.
- data can be any value.
- options - null or disable encryption with:
{encrypt:false}
Example :
let cache_id = "unique_id";
let data = "Data into cache";
let options = null;
set_cache(cache_id, data, options);
get_cache
Retrieves a cache entry identified by cache_id.
Returns the cached data, or null if no entry exists.
let result = get_cache(cache_id);
Arguments :
- cache_id is a unique identifier for the cache data.
Example :
let cache_id = "unique_id";
let result = get_cache(cache_id);
log("cache value :", result);
clear_cache
Removes a cache entry identified by cache_id.
clear_cache(cache_id);
Arguments :
- cache_id is a unique identifier for the cache data.
Example :
let cache_id = "unique_id";
clear_cache(cache_id);
cleanup_cache
Removes all cache entries.
cleanup_cache();
Example :
cleanup_cache();