Skip to main content

Content Management

Content Cache - ContentMK Docs

How ContentMK caches WordPress content locally for instant loading.

ContentMK caches your WordPress articles and media files locally on your computer. Instead of waiting for your WordPress server to respond every time you open an article, ContentMK loads it from a local copy in milliseconds. This page covers what gets cached, how the sync process works, and how to manage your cache storage.

What Gets Cached

When you import or sync content from WordPress, ContentMK saves a local copy of each article and its associated media. The cache includes:

  • Article content — The full HTML of each WordPress post, plus a Markdown version for quick preview
  • Images — Featured images, inline images, and other media referenced in your posts
  • PDFs and videos — Any media files attached to your posts

Once cached, all of this content is available instantly without a network request.

How It Works

Instant Loading with a Sync Gate

When you open a cached article, ContentMK shows the cached version immediately so you can start reading right away. At the same time, it checks WordPress in the background to confirm the content is still current.

This check compares the last modified timestamp stored in the local cache against the value returned by the WordPress REST API. If the timestamps match, the article is confirmed up to date and editing is unlocked. If WordPress has a newer version, editing stays locked until the cache is updated with the latest content.

This sync gate prevents you from accidentally editing stale content. You always see the article instantly, but ContentMK ensures you are working with the most recent version before you make changes.

Media Deduplication

If the same image appears in multiple articles, ContentMK stores it only once. Files are identified using SHA-256 content hashing, which means identical files are detected automatically regardless of their filenames or URLs.

For example, if five articles all use the same header image, only one copy is stored in the cache. This saves significant disk space on sites that reuse media across posts.

Storage Location

Cached files are stored separately from your main ContentMK database:

~/ContentMK/cache/{site-id}/
  articles/    -- HTML and Markdown files
  media/       -- Images, PDFs, videos

The main database lives at ~/ContentMK/data.db, while the cache directory holds the raw files. This separation means you can delete the entire cache directory to reclaim disk space without affecting your article data or any content on WordPress. Files will be re-cached automatically the next time you sync.

Viewing Cache Stats

You can check the current state of your cache in Site Settings under the Content Cache section. The stats include:

  • Total size — How much disk space the cache uses for this site
  • File count — Total number of cached files (articles and media combined)
  • Article count — Number of cached articles
  • Media count — Number of cached media files (images, PDFs, videos)

These numbers update each time you open Site Settings, giving you a clear picture of how much local storage each site is using.

Clearing the Cache

Click Clear Cache in Site Settings to remove all cached content for a site. This deletes both the cached files on disk and the corresponding database entries that track them.

Clearing the cache does not affect your articles in ContentMK or your posts on WordPress. It only removes the local copies. Content will be re-cached the next time you sync or import from WordPress.

You can also safely delete the cache directory manually from your file system if you prefer. The result is the same — ContentMK will rebuild the cache on demand.

Cache Limits

The default maximum cache size is 5 GB per site. When the cache exceeds this limit, ContentMK automatically removes the least-recently-viewed files to make room for new content. Articles and media you access frequently are kept in the cache, while older or rarely viewed files are evicted first.

This LRU (least recently used) eviction strategy means the cache stays within its size budget without requiring any manual cleanup. The limit is configurable if you need more or less space allocated per site.

Cache vs Article Files

It is worth understanding the difference between the content cache and Article Files, since they serve different purposes:

  • Content Cache is a hidden, temporary store used for performance. It holds copies of WordPress content so articles load instantly. Cache files are managed automatically and can be cleared at any time without losing data.
  • Article Files are permanent, user-managed folders where you store your own documents, images, and reference material for each article. These are part of your working files and are not affected by cache operations.

The two systems are completely independent. Clearing the cache does not touch your Article Files, and managing Article Files has no effect on the cache. Think of the cache as ContentMK’s behind-the-scenes optimization layer, while Article Files are your personal workspace.