When David was in the cave, and the armies of the enemy were surrounding him, Psalm 142 came to David to give him comfort.
He cried out to the Lord, pleading for mercy from the One True God. He poured out his soul to God, telling God of his trouble.
Though his spirit was weak with the trial he was facing, God knew the way that he should go. Though the enemy had set a trap for David, God knew all about it. Though he could find no one who noticed his righteousness, no refuge and no care, God knew David.
So he cried out to God. "God, You are my refuge! You have given me my portion in the land of the living!" David asked God to hear his cry, for he was very low. He asked God to deliver David from his persecutors, they were stronger than David. He asked God to deliver him from the prison of the surrounded cave, and he would give thanks to the Name of the One True God.
David got comfort in the Lord. He said that the righteous would surround him, for God had dealt bountifully with him.
As Christians, we should ask ourselves: Do we look to God for our refuge and our safety? When the enemy surrounds us, do we cry out unto the Lord who gives us strength, or do we bottle ourselves up in defeat? If we were in David's shoes, would we have turned towards the Lord, or would we have tried to fortify the cave?