That’s what the docs recommend. I’d suggest using variable names other than “transform” and “rigidbody”, since normally those alone refer to the transform and rigidbody of the gameobject. The drawback would be increased memory usage (not much though).
The only problem that could arise as far as I can see is if the class actually requires the uncached components, which should only really happen if components are added/removed mid scene.
Other than that, it’s a fairly sound and safe optimization.
Is there any way to use this technique to be able to use the same name for a public and static variable? I love to assign variables in the inspector, but be able to use them in other scripts without having to create references. When you use the static keyword, the variables are no longer editable in the inspector, but I’d rather not have to “rename the variables” in order to use them elsewhere. (This is also a waste of memory.)