A library that aids in static asset cache busting with SHA-256 hashes
Find a file
Aravinth Manivannan 3167cfdc0d
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Merge pull request 'fix(deps): update rust crate sha2 to 0.11' (#27) from renovate/sha2-0.x into master
Reviewed-on: #27
2026-06-19 21:27:44 +05:30
.github/workflows Merge pull request 'chore(deps): update actions/checkout action to v7' (#30) from renovate/actions-checkout-7.x into master 2026-06-19 16:25:40 +05:30
.reuse feat: rename to libcachebust and init reuse 2023-10-16 23:35:41 +05:30
dist no_hash copies files 2021-07-05 15:24:56 +05:30
examples/actix-web feat: change name to libcachebust 2023-10-17 00:22:06 +05:30
LICENSES feat: rename to libcachebust and init reuse 2023-10-16 23:35:41 +05:30
src feat: change name to libcachebust 2023-10-17 00:22:06 +05:30
.gitignore documentation 2021-05-12 18:20:26 +05:30
.woodpecker.yml feat: update CI manifest to steps & apply event filter 2026-06-19 15:43:41 +05:30
Cargo.lock fix(deps): update rust crate sha2 to 0.11 2026-06-19 11:39:12 +00:00
Cargo.toml fix(deps): update rust crate sha2 to 0.11 2026-06-19 11:39:12 +00:00
CHANGELOG.md feat: change name to libcachebust 2023-10-17 00:22:06 +05:30
README.md feat: change name to libcachebust 2023-10-17 00:22:06 +05:30
renovate.json Add renovate.json 2024-06-08 10:47:04 +00:00

A photo of Spock showing the Vulkan greeting

libcachebust

May your cache live long and prosper!

status-badge

What is cache busting?

To optimise network load time, browsers cache static files. Caching greatly improves performance but how do you inform browsers to invalidate cache when your files have changed?

Cache busting is a simple but effective solution for this issue. There are several ways to achieve this but the way this library does this is by changing file names to include the hash of the files' contents.

So if you have bundle.js, it will become bundle.<long-sha256-hash>.js. This lets you set a super long cache age as, because of the file names changing, the path to the filename, too, will change. So as far as the browser is concerned, you are trying to load a file that it doesn't have. Pretty neat, isn't it?

Features

  • SHA-256 based name generation during compile-time
  • Processes files based on provided MIME filters
  • Exclude certain files from processing based on file extensions and/or file paths
  • Exposes modified names to program during runtime
  • Route prefixes(optional)

Usage:

Add this to your Cargo.toml:

libcachebust = 0.2

Examples: