Why Editing Templates in External Editors Does Not Take Effect

Calendar 👁️ 436

Description of the template cache mechanism

AnQi CMS uses memory cache optimization strategy in the production environment:

  1. Preload at startup:Load the template files into memory all at once when the service starts
  2. Rendering Acceleration:Page requests directly read memory templates, avoiding repeated disk I/O operations
  3. Performance Advantages:Reduce server load, improve web page response speed to milliseconds

Development modification注意事项

When modifying template files through external editors (Baota panel/VSCode, etc.):

  • ✖ Modification only affects disk files
  • ✖ The memory cache template does not update automatically
  • ✔ It needs to take effect in the following way:
  • ▸ Restart the service (production environment)
  • ▸ Switch to development environment (recommended for development stage)

Guide to environment configuration

Open the root directory underconfig.json, findenvConfigure and modify it.

Development mode (development)

Note that reading the template in real-time with each request will increase the server load

{
    ...
    "server": {
        "env": "development",
        ...
    }
}

Applicable scenarios: template debugging period, website development stage Performance impact: increases server IO

Production Mode (production)

{
    ...
    "server": {
        "env": "production",
        ...
    }
}

**Practice:

  1. Maintain development mode during the development period
  2. Complete full-scale testing before going online
  3. When deploying, switch to production mode
  4. Template update must follow the 'Modify→Restart' process