Hello!
> Can I achieve this without using lua_shared_dict directive?
No, you can't. A lua_shared_dict object contains a shared memory(underlying), the allocation of shared memory is early than any phase you can get involved like init_by_lua, init_worker_by_lua and so on.