In the title of some psalms the Holy Spirit gives us information as to the time and situation in David’s life when he composed the song. That helps to better understand the background of the psalm as well as its content. This Psalm was written when David was in the cave.
1 With my voice I cry out to the LORD; with my voice I plead for mercy to the LORD.