The cache issues in the beta version of Flarum are the main cause of various errors in this forum application, such as nojs, changes made to the style in the admin panel not being reflected on the frontend, and errors when switching languages, displayed as xxx.xxx.xx. Below, I will explain Flarum's caching mechanism in detail.

Flarum's cache consists of three major parts:

Main Cache (the main cause of most nojs pages)

Introduction: The merged JS and CSS files generated by the forum that support the entire Flarum website. When debug is disabled (the default), they are compressed; when debug is enabled, they are uncompressed.

Location: The admin-xxx.css, admin-xxx.js, forum-xxx.js, and forum-xxx.css files, as well as rev-manifest.json, under the /assets directory.

Purpose: As the names suggest, the two files beginning with admin represent the JS and CSS files for the admin panel, while those beginning with forum represent the JS and CSS files for the website frontend. rev-manifest.json records the names of these four files. When the website is opened, it sends a request for rev-manifest.json to obtain the corresponding CSS and JS files.

Clearing: The official recommendation is to cd to the website root directory and enter php flarum cache:clear to clear the cache. However, this command does not delete rev-manifest.json, and some extensions require you to manually delete the rev-manifest.json file after clearing the cache.

Storage Cache (a cause of some nojs pages)

Introduction: The cache files initially generated by Flarum (extracting JS, CSS, and other files from the system and extensions and storing them separately under /storage in the root directory), which are then merged into the main cache above.

Location: The cache, formatter, less, locale, tmp, views, and other folders under the /storage directory.

Purpose:

  • cache: Regular cache, containing various cached content used by the forum in compressed, dispersed form. If an extension does not work or causes nojs after you enable it, and clearing the main cache does not help, delete all files in this folder. This will generally solve the problem.
  • formatter: BBCode cache. If you add custom BBCode (including adding or editing the flarum-ext-mediaembed extension for online video), be sure to manually delete the files in this folder.
  • less: As the name suggests, all Less cache used by the forum (Less is, simply put, an advanced version of the CSS language; all of Flarum's CSS is generated by Less). If style errors occur after enabling or disabling an extension, consider deleting all files in this folder.
  • locale: After switching to Chinese, if titles, buttons, and other elements all display xx.xxxx.xxxx, don't overthink it—delete all files in this folder. It is used to cache language files.
  • tmp: Temporary forum cache, which is normally cleared automatically.
  • views: View cache, containing cached CSS, HTML, and other content.

Browser Cache

There is not much to explain here. Basically, every time you clear the cache, you need to press Ctrl + F5 to refresh the browser page, because Flarum does not synchronously update the browser cache after you make changes.

Summary: The main reason Flarum has so many problems is its caching mechanism. There are many places where cache is stored, and several caches may fail to refresh synchronously due to various issues. Of course, if you do not change the admin settings after installing the forum (especially extension toggles or extension settings), Flarum remains as stable as a rock.