redis_func_cache.utils module#
- redis_func_cache.utils.b64digest(x)[source]#
Convert hash digest to base64 string.
- Parameters:
x (
Hash) – The hash object.- Return type:
- Returns:
The base64 encoded digest of the hash object.
This function takes a hash object (e.g., SHA256, MD5, etc.) and returns its digest, encoded in Base64 format, with “=” paddings stripped.
It is useful when you need to represent a hash value in a compact and readable format.
- redis_func_cache.utils.clean_lua_script(source)[source]#
Remove comments and empty lines from a Lua script.
- redis_func_cache.utils.get_callable_bytecode(obj)[source]#
Retrieve the bytecode of the given callable object.
- redis_func_cache.utils.read_lua_file(file)[source]#
Read a Lua file from the package resources.
- Parameters:
file (
str) – The name of the Lua file to read.- Return type:
- Returns:
The contents of the Lua file as a string.
This function locates and reads the entire text content of a specified Lua file. It uses the
importlib.resourcesto locate the file.