Add cache to derivation