Redefined classes are never stored in the cache. Retransformed classes are not stored in the cache by default, but caching can be enabled using the -Xshareclasses:cacheRetransformed option.
Redefined classes are classes containing replacement bytecode provided by a JVMTI agent at runtime, typically where classes are modified during a debugging session. Redefined classes are never stored in the cache.
Retransformed classes are classes with registered retransformation capable agents that have been called by a JVMTI agent at runtime. Unlike RedefineClasses, the RetransformClasses function allows the class definition to be changed without reference to the original bytecode. An example of retransformation is a profiling agent that adds or removes profiling calls with each retransformation. Retransformed classes are not stored in the cache by default, but caching can be enabled using the -Xshareclasses:cacheRetransformed option. This option will also work with modification contexts or partitions.