How great is the goodness, O LORD,
which you have in store for those who fear you,
And which, toward those who take refuge in you,
you show in the sight of the children of men.
You hide them in the shelter of your presence
from the plottings of men;
You screen them within your abode
from the strife of tongues.
Blessed be the LORD whose wondrous mercy
he has shown me in a fortified city.
Once I said in my anguish,
“I am cut off from your sight”;
Yet you heard the sound of my pleading
when I cried out to you.
Love the LORD, all you his faithful ones!
The LORD keeps those who are constant,
but more than requites those who act proudly.
31:20. His petition is followed by a proclamation of God’s goodness towards those who fear him (meaning, as we can see, those who have recourse to him in the temple).
31:21–22. The psalmist bears witness to the fact that the prayer of the temple—“the fortified city” or Jerusalem (v. 21)—was heard at times when the people felt abandoned by God—“cast out of your presence” (v. 22).
31:23–24. Therefore, he calls on those whose faith has wavered to love the Lord and to hope in him.
Like its companions, Psalm 31 is an individual prayer for help from distress. The theme of the whole is stated in the formulaic sentence: “In you, LORD, I take refuge.” The motif of refuge is continued in metaphors like rock, stronghold, fortress, and crag and is resumed at the end in verses 19–24. Indeed, the prayer as a whole is a “taking refuge in the LORD.”
The psalm has been called a model of a prayer that is confident of being heard. This confidence informs the prayer from start to finish; to pray this psalm is to be led into and instructed in this confidence. But the confidence of the prayer is not in any respect a virtue of the one who prays. It is, rather, a possibility that is based on the character of the one to whom the prayer is made.
So the one who prays run of course to Jesus. Prophet and Messiah are both scriptural illustrations of the identity of the servant who in the face of opposition commits his life to the LORD. Their examples show how even through failure and death, the providence of the faithful God determines the “times” of his servants. They encourage and exhort us through the words of verses 23–24 to find love, strength, and courage in life and death through making a commitment of trust in the Lord.
– James Mays
May the virtues of faith, hope, and love go with you today – DV.
 James Gavigan, Brian McCarthy, and Thomas McGovern, eds., Psalms and the Song of Solomon, The Navarre Bible (Dublin; New York: Four Courts Press; Scepter Publishers, 2003), 120–121.