Refactor CacheEnvelope in spu.cpp