title: Why does documentation use lru_cache decorated function to get settings, instead of importing an initialized settings object from the module directly
body: <p>FastAPI documentation recommends using lru_cache decorated functions to retrieve the config file. That makes sense to avoid I/O getting the env file.</p>
  <pre class="lang-py prettyprint-override"><code>config.py
  from pydantic import BaseSettings
  
  
  class Settings(BaseSettings):
      app_name: str = &quot;Awesome API&quot;
      admin_email: str
      items_per_user: int = 50
  
      class Config:
          env_file = &quot;.env&quot;
  
  </code></pre>
  <p>and then in other modules, the documentation implemented a function that gets the settings</p>
  <pre class="lang-py prettyprint-override"><code>#module_omega.py
  from . import config
  
  @lru_cache()
  def get_settings():
      return config.Settings()
  
  settings = get_settings()
  print(settings.ENV_VAR_ONE)
  </code></pre>
  <p>I am wondering if this method is better practice or advantageous to just initializing a settings object in the config module and then importing it like below.</p>
  <pre class="lang-py prettyprint-override"><code>#config.py
  from pydantic import BaseSettings
  
  
  class Settings(BaseSettings):
      app_name: str = &quot;Awesome API&quot;
      admin_email: str
      items_per_user: int = 50
  
      class Config:
          env_file = &quot;.env&quot;
  
  settings = Settings()
  
  </code></pre>
  <pre class="lang-py prettyprint-override"><code>#module_omega.py
  
  from .config import settings
  
  print(settings.ENV_VAR_ONE)
  </code></pre>