I have a question about the idea of lua code cache.
In ngx_http_lua_cache_store_code, when the ref argument is not LUA_NOREF,
we generate a new ref number and store ref:closure-factory and key:ref as
KEY:VALUE into cache table; and in ngx_http_lua_cache_load_cache, when the
ref argument is LUA_REFNIL, we first get ref by key and then get closure
factory by ref from the cache table. I don't understand why we need the
2-level cache, Wouldn't it slow down the process of loading code? Can we
just use the ref for code not specified by file path which contains nginx
variable(src_ref == LUA_NOREF)?
Thanks in advance for the clarifications.