Your Search Bar For Shrewd Tips

How Do I Clear Ckan Cache?


If pages in your CKAN portal are showing old information, configuration changes are not appearing, or search results seem out of date, clearing the right cache may help. The key is to identify which layer is storing the stale content: CKAN itself, a Redis or other cache service, a web server or CDN, your browser, or the search index. These components do different jobs, so clearing one does not necessarily clear the others.

This guide explains how to clear CKAN cache safely, how to check which cache your installation uses, and what to do if the problem is actually a stale search index or browser copy. Because CKAN versions and deployments vary, confirm your configuration before running commands that remove stored data.

What Does Clearing the CKAN Cache Mean?

“The CKAN cache” can refer to several separate layers. An installation might use an application cache, Redis, an in-memory cache, browser caching, or a reverse proxy or content delivery network (CDN). It may use more than one at the same time. A restart can clear some temporary, process-local data, for example, but it will not necessarily remove entries stored in Redis or a CDN.

  • Application cache: Cached results or other temporary data used by CKAN or its extensions.
  • Redis or another cache service: A separate service that may store cache entries, sessions, or other application data, depending on configuration.
  • Browser cache: Local copies of pages and static assets saved by a visitor’s browser.
  • Proxy or CDN cache: Copies of responses or files stored in front of CKAN to improve delivery speed.
  • Search index: Solr’s index of searchable CKAN records. This is not the same as a page cache.

Before clearing anything, note what is stale and where you see it. A changed dataset description that appears correctly on its detail page but not in search points to a different issue than an old logo that appears only in one browser.

Step 1: Check Your CKAN Cache Configuration

Start by identifying the CKAN configuration file used by your deployment. It is often named ckan.ini and may be located in a directory such as /etc/ckan/default/, but paths differ. Check the deployment documentation or service configuration rather than assuming a path.

Look for cache-related settings, including any configured cache URL or Beaker cache options. Some installations use Redis; others use a different backend or no shared cache at all. Also check whether your organization uses a reverse proxy or CDN. If you are unsure what a setting does, ask the CKAN administrator before changing it: configuration can vary by CKAN version, extension, and hosting setup.

It can also help to check which CKAN service is running and how it is named. A systemd service might be called ckan, ckan.service, or something specific to the installation. The examples below use common patterns, not universal service names.

Step 2: Restart CKAN to Clear Temporary Application State

If you have just changed a setting, installed an extension, or updated application code, restarting the CKAN web application is a reasonable first step. A restart replaces running application workers and can clear data held only in their memory. It is usually less risky than flushing a shared cache database, although it may briefly interrupt service.

On a system that uses systemd, an administrator might restart CKAN with a command like this:

sudo systemctl restart ckan

Use the actual service name for your installation. If CKAN runs in containers, through a process manager, or on a managed hosting platform, restart it using that environment’s procedure instead. Avoid restarting PostgreSQL, Solr, or Redis just to refresh CKAN pages; those are separate services and restarting them can affect more than the application cache.

After the restart, load the page again and check whether the issue is resolved. If not, review the application logs for startup errors or cache-related warnings. A failed restart or an unhealthy worker can look like a caching problem even when it is not.

Step 3: Clear a Redis Cache Carefully

If your CKAN configuration uses Redis for caching, restarting CKAN alone may not remove entries stored in Redis. First confirm the Redis host and database number from the active configuration. Do not assume that Redis database 0 or 1 is the correct one, and do not assume the Redis instance is used only for CKAN cache data.

Flushing a Redis database removes its stored keys. If that database also contains sessions, queues, or data used by another application, clearing it can log users out or disrupt other services. Only proceed if you are authorized and have confirmed that the target database is dedicated to disposable cache entries. Take a backup or follow your organization’s recovery process if required.

For a dedicated Redis cache database, an administrator may use a command in this general form, replacing the database number with the one confirmed in the configuration:

redis-cli -n 1 FLUSHDB

This example is not safe to copy blindly. Check the Redis host, authentication requirements, and database selection first. If Redis is shared, managed by a hosting provider, or used for multiple purposes, use the provider’s documented cache-clearing procedure or ask the system administrator. Avoid FLUSHALL: it removes keys from every Redis database on that server and is rarely an appropriate way to clear one application’s cache.

Step 4: Clear Browser, Proxy, or CDN Cache

If CKAN looks correct to other users but not on your device, start with the browser. Open the page in a private or incognito window, or perform a hard refresh. If the updated page appears there, clear the browser’s cached files for the site. You generally do not need to erase cookies or saved passwords just to refresh cached page assets.

If multiple users see the same outdated page or file, investigate the web server, reverse proxy, or CDN in front of CKAN. These layers may cache HTML responses, images, stylesheets, or JavaScript independently of the CKAN application. Purge only the affected URL or asset where possible, using the platform’s documented controls. A full CDN purge can increase traffic to the origin and may be unnecessary.

When replacing a static file such as a logo or stylesheet, browsers may keep an older copy even after the server has been updated. Versioning the asset URL or using a suitable cache-busting method can help visitors receive the new file without repeatedly clearing their entire browser cache.

Is the Search Index Stale? Rebuild It Separately

Clearing cache does not rebuild CKAN’s search index. CKAN commonly uses Solr to provide search results, and the index can fall behind the database if an update or indexing task fails. For example, a dataset may show its new title on its page while search still displays the old title. That pattern suggests an indexing issue rather than a browser cache.

Check your CKAN version and deployment documentation for the supported search-index command. In many installations, the command is run through the CKAN command-line interface with the configuration file specified; older deployments may use a different command or wrapper. Confirm the exact syntax for your version before running a rebuild, especially on a large production portal, where indexing can take time and consume resources.

Do not rebuild the search index simply because a page looks stale. A full rebuild is a separate maintenance task, and it may not resolve problems caused by a CDN, browser, or application cache. Check logs and indexing status first, and follow your organization’s maintenance procedure.

How to Verify That the Cache Is Cleared

After clearing a cache or restarting CKAN, test the specific page or file that appeared outdated. Use a private browser window and, if possible, compare the result from another device or network. Confirm that the expected change is visible and that key features such as login, dataset pages, downloads, and search continue to work.

  • Check the CKAN page directly, not just a search-result snippet.
  • Compare the result in a private window to rule out a local browser copy.
  • Check application and service logs for errors after a restart or cache operation.
  • Confirm that search results are current if the change involved a dataset record.
  • Ask another user to verify the result if a proxy or CDN may be involved.

If the old content remains, avoid repeating increasingly destructive commands. Record the affected URL, the time of the change, and which cache-clearing steps you have tried. That information helps an administrator trace whether the issue is in CKAN, Redis, Solr, a proxy, or the browser.

Common Mistakes to Avoid

  • Flushing the wrong Redis database: This can remove sessions or data unrelated to the cache.
  • Using FLUSHALL as a shortcut: It clears every database on the Redis server, not just CKAN’s cache.
  • Confusing search with caching: Solr indexing and application cache clearing are separate tasks.
  • Deleting files or directories without checking: CKAN deployments differ, and removing files manually can cause outages or remove useful data.
  • Restarting every service: Restart only the component needed, following your deployment’s procedures.
  • Ignoring cache layers in front of CKAN: A CDN or browser can continue serving old content after the application has updated.

Conclusion

To clear CKAN cache, first identify which layer is serving the stale content. Restarting CKAN can refresh temporary application state, while a Redis cache, browser, proxy, or CDN may require a separate action. If the problem is outdated search results, investigate Solr indexing rather than treating it as a cache issue.

Always confirm your CKAN configuration and deployment-specific instructions before removing stored data. Targeted, cautious troubleshooting is safer than clearing every cache at once—and makes it easier to find the real cause when a CKAN page still shows old information.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


💡 Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments 👇

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum →