A lizard that basks in the sun knows there is a cave nearby.
Lizards are known to have basking sites (rocks) for sunbathing, and retreat sites (shelters) to avoid being preyed upon by other creatures such as hawks and snakes.
Easy access to retreat sites provides an opportunity for escaping quickly, and refuge from predators. Lizards will choose basking sites consisting of high rocks near their retreat sites. Deep and long crevices in large rocks, and spaces between the bottom of rocks are typical retreat sites.
A wise person will knowingly take a risk, having considered how to deal with the potential downside.