Of course. Let's break down the listcache directory in DedeCMS (织梦内容管理系统). This is a core concept for understanding how DedeCMS improves performance.

What is the listcache Directory?
In simple terms, listcache is a special cache folder used by DedeCMS to store the results of dynamic list pages.
When a user visits a category page, a search results page, or a tag page, DedeCMS has to query the database to get the list of articles. This process can be slow, especially on sites with thousands of articles.
To speed this up, DedeCMS can generate a static HTML file for that list page and save it in the listcache directory. The next time a user requests that same page, the web server will directly send the pre-generated HTML file from listcache without needing to query the database again.
This is a form of page-level caching.

Where is it located?
The listcache directory is typically found in the root directory of your DedeCMS installation, alongside other important folders like data, images, uploads, etc.
/your-dedecms-site/
├── /data/
├── /images/
├── /include/
├── /listcache/ <-- This is the one!
├── /special/
├── /templets/
├── /uploads/
├── index.html
├── default.php
└── ...
What Files are Inside listcache?
The files inside listcache are not named in a very human-readable way. They are typically hash strings or numbers corresponding to the specific list query.
For example, you might see files like:
c1d1a2b3.html(Cache for Category ID 1)search_a_b_c.html(Cache for a search query)tag_php_1.html(Cache for the first page of articles tagged with "php")
Key Point: These are static HTML files. You can open one in a text editor to see the fully rendered HTML of a list page.

How Does it Work? (The Mechanism)
- User Request: A user visits
http://your-site.com/plus/list.php?tid=1. This is the dynamic URL for articles in Category ID 1. - DedeCMS Check: DedeCMS checks if a corresponding cache file exists in
/listcache/. Let's say it looks forc1d1a2b3.html. - Cache Hit (File Exists):
- DedeCMS finds the file.
- It checks if the cache has expired. This is controlled by a cache time setting (e.g., 3600 seconds = 1 hour).
- If the cache is not expired, DedeCMS bypasses the database and sends this static HTML file directly to the user's browser. This is very fast.
- Cache Miss (File Doesn't Exist or is Expired):
- DedeCMS cannot find a valid cache file.
- It performs the normal process: connects to the database, runs the query to get the articles for
tid=1, processes the template (list_article.htm), and generates the HTML. - Crucially, it then saves this newly generated HTML to a file in the
listcachedirectory for future requests. - Finally, it sends the HTML to the user's browser.
How to Control the listcache?
You can manage this feature through the DedeCMS backend.
Enabling/Disabling Caching
Go to DedeCMS Backend > System > System Basic Settings > Core Settings.
Look for an option like:
是否使用列表页缓存(Whether to use list page caching)列表缓存开关(List cache switch)
You can set this to Y (Yes) or N (No). Setting it to N will disable the feature entirely.
Setting Cache Time
In the same Core Settings area, look for an option like:
列表缓存时间(List cache time)
This value is usually in seconds. A common setting is 3600 (1 hour). You can adjust this based on how often you update your content. For a very active blog, you might set it to 600 (10 minutes). For a static site, you could set it to 86400 (24 hours).
Manually Clearing the Cache
Sometimes you need to clear the cache manually, for example, after adding a new article to a category or changing a template.
-
Via Backend (Recommended):
- Go to DedeCMS Backend > System > Performance Settings > Clear All Cache.
- There should be an option to "Clear list cache" or "更新栏目HTML/列表缓存" (Update Category HTML/List Cache). Clicking this will delete all files in the
/listcache/directory.
-
Manually (via FTP or File Manager):
- Connect to your server via FTP or use the cPanel File Manager.
- Navigate to the
/listcache/directory. - Delete all the files inside it. Do not delete the
listcachedirectory itself, just its contents.
Advantages and Disadvantages
Advantages:
- Massive Performance Improvement: Reduces database load significantly, making your site much faster for visitors, especially during traffic spikes.
- Lower Server Resource Usage: Fewer database queries mean less CPU and memory usage on your server.
- Better User Experience: Faster page load times lead to happier users.
Disadvantages:
- Stale Content: If the cache time is set too long, new articles won't appear on list pages until the cache expires. This is the biggest trade-off.
- Increased Disk Usage: Each cached list page is a file on your server. For a site with hundreds of categories/tags, this can add up to many megabytes of disk space.
- Complexity for Developers: When developing custom modules or modifying list logic, you have to remember that the cache might be serving an old version of the page, requiring manual clearing.
Summary
| Feature | Description |
|---|---|
| Purpose | To speed up list pages (categories, tags, search) by serving pre-rendered HTML files. |
| Location | /listcache/ directory in your DedeCMS root folder. |
| Content | Static HTML files, one for each unique list query. |
| Control | Managed in DedeCMS Backend > System > System Basic Settings > Core Settings. |
| Key Settings | Cache Switch (Y/N) and Cache Time (in seconds). |
| Maintenance | Clear the cache manually from the backend or by deleting files in the directory after updating content or templates. |
Understanding listcache is essential for any DedeCMS site owner or developer who wants to optimize their site's performance.
