tips
24 tips Cache
One command, setting or habit at a time about Cache: what it does, the line to copy and a caveat or two.
Cache and Mover 8
-
Where Unraid schedules TRIM for pool SSDs, and how to run it once by hand.
fstrim -v /mnt/cache -
Choose a cache file system that lets you add a mirror drive later without reformatting.
Main > click the pool > File system type: btrfs or zfs -
Stop the Mover from moving your VM disks to the slow array.
Use cache: Prefer -
See exactly which files the Unraid Mover moved, and spot the ones it left behind.
Settings > Scheduler > Mover Settings > Mover logging -
Explains why files moved between user shares stay on the cache and how to move them properly.
mv /mnt/user/downloads/file.mkv /mnt/user/media/ -
Makes Unraid send new files to the array instead of filling a cache pool to the brim.
Main > (pool name) > Individual Pool Settings > Minimum free space -
Prints how often PHP reuses compiled scripts and how full the opcode cache memory is.
print_r( opcache_get_status( false )['opcache_statistics'] ); -
Reads the hit and miss counters of a Redis server to calculate how well its cache works.
redis-cli info stats | grep -E 'keyspace_(hits|misses)|evicted_keys|expired_keys'
Build and system 7
-
See whether a file is being served from RAM or still from disk.
fincore /var/lib/example/data.db -
Check the package cache for damage and clear out unneeded data safely.
npm cache verify -
Get programs to see a font you just copied into your home folder.
fc-cache -f -v ~/.local/share/fonts -
Deletes the cached package files that apt keeps after each download to free disk space.
sudo apt clean -
Explains the buff/cache column and how to drop the kernel page cache for testing.
free -h -
Shows the size of pip's local cache and clears it when it gets too big.
pip cache dir -
Forces a full rebuild without stored layers and removes old build cache entries by age.
docker builder prune --filter until=72h
HTTP and nginx 7
-
Protect a slow backend when many visitors ask for an expired page at once.
proxy_cache app; -
Pick the right header for fresh pages versus pages that must not be saved.
Cache-Control: no-cache -
Visitors get a fast answer even right after the content expires.
Cache-Control: max-age=60, stale-while-revalidate=600 -
Marks fingerprinted files as never changing so browsers skip revalidation on reload.
add_header Cache-Control "public, max-age=31536000, immutable"; -
Adds a response header that tells you if nginx answered from its FastCGI cache.
fastcgi_cache WP; -
Sends the stored ETag back to the server to check that it answers 304 Not Modified.
curl -sI -H "If-None-Match: $etag" https://example.com/app.js | head -1 -
Prints the response headers that decide how long browsers and proxies may keep a file.
curl -I https://example.com/style.css
WP-CLI 2
-
Scans a Redis instance and reports the biggest keys per type without blocking the server.
redis-cli --bigkeys -i 0.1 -
Shows live Redis commands for a moment while keeping the load on a busy server small.
redis-cli monitor | head -n 20
Nothing in this filter yet.