What is a cache and why do I need to refresh it?

David posted a comment to my last blog entry with a sarcastic “What is a cache and why do I need to refresh it?”. He's got a valid point.

To me, having “refreshing a cache” in the status UI is much like the rationale for having both suspend and hibernate in the UI. The user shouldn't need to know the difference between suspend and hibernate as they are both ways of making the computer “sleep”. The reason why we have to expose both into the UI is that suspend is fast, but has volatility, and hibernate is slow but doesn't. This is just a technical design decision that is made due to other unfixable design decisions or hardware limitations.

I think it's much the same for refreshing a cache. The user shouldn't have to know what it is doing, it should just work, but the unfortunate drawback is that refreshing a cache can take quite a long time and during that time none of the other functionality like searching or getting the update list works until this is completed.

So, the short answer is that the cache is automatically updated on the first logon (20 seconds after the network comes up for the first time) and then every 12 hours after that. It will be per-session configurable in gconf for sure (as you don't want to suck 500k of metadata down a 14k dial up link….), and you can also force a refresh in the update GUI tool.

I welcome other more less-technical names for “Refreshing package cache” maybe:

  • Updating package lists
  • Updating software metadata
  • Refreshing repository data

Other name suggestions welcome. Reply via blog or email. Thanks.

Published by

hughsie

Richard has over 10 years of experience developing open source software. He is the maintainer of GNOME Software, PackageKit, GNOME Packagekit, GNOME Power Manager, GNOME Color Manager, colord, and UPower and also contributes to many other projects and opensource standards. Richard has three main areas of interest on the free desktop, color management, package management, and power management. Richard graduated a few years ago from the University of Surrey with a Masters in Electronics Engineering. He now works for Red Hat in the desktop group, and also manages a company selling open source calibration equipment. Richard's outside interests include taking photos and eating good food.

One thought on “What is a cache and why do I need to refresh it?”

  1. I don't think updating the package cache automatically after logon is great, expecially on old machines…this could take several minutes to get a ready for use desktop.

Comments are closed.