Set cache_dirty flag to be a bitmask; add accessors and update code.