Make sure the cave is at least 3 blocks high, since the big ones are 2.5 blocks high. Also they spawn close to bedrock level up to level 40 so they can spawn in any caves in between. You also need to be at least 23 blocks away from the area to make them
spawn. Another thing to do is make sure nearby caves are lit up because the slimes have a lower percentage spawn rate than the other mobs. By lighting the caves means that no other hostile mob can spawn which makes the slimes spawn more often.
You asked about lava. Lava will kill a slime if it jumps into it so avoid the lava. As well, big slimes will die if hit with a diamond sword and not make littler slimes. Hit them with wooden tools to get them to split and make smaller slimes which can then
be hit to make smaller ones until you get the smallest and get a slime ball.