It turns out that
.db-wal (
Write-Ahead Logging) and
.db-shm (
Shared-Memory) files are associated with
sqlite databases generally, not with cache files in particular. More specifically, they are parts of a mechanism by which changes to a database are recorded separately from the original as security against corruption due to a crash in the middle of a transaction (not unlike filesystem journaling in OS X—in fact, the traditional way of doing this in
sqlite is via a
rollback journal).
On the first page linked to above, mentioned as among the disadvantages of WAL mode are "an additional quasi-persistent "-wal" file and "-shm" shared memory file associated with each database."