The psalmist begins this section by crying out to God for deliverance. As the section develops he becomes confident, and part of the reason for his confidence can be found in v. 152.
Memory: he remembers that long ago he learned the decrees and he learned at that time that God’s decrees are set in stone. They are permanent because God is permanent.
So, the opponents may be near, but God is also near. And because God’s judgment is true and because God’s decrees are permanent and forever, he can utter a sense of relief: he can rely on God to deliver him.
I find this psalm a bit like Psalm 77 — where we find a psalmist struggling with God until he finds relief in remembering the faithfulness of God.