The tcDspStorageCache class is used to provide a simple read/write cache for other physical devices derived from the tcDspStorageBase class. The constructor takes a pointer to a tcDspStorageBase object for the underlying device, and the number of sectors worth of cache to provide.
As sectors are ready off the disk, the cached data is placed in a linked list. The most-recently accessed data is always moved to the head of the list. When the list is full, the oldest entry is purged to make room for the newest.
When a sector is written to, the cached copy is marked as dirty. Dirty sectors are written back to the device only when they are removed from the cache (i.e., they become the oldest entry and are purged to make room for new data), or when manually flushed via a zero byte write to sector 0xFFFFFFFF.
This is a simple example of tcDspStorageCache creation and usage: