Psalm 34 was written by King David and recalls the time when he pretended to be insane in order to spare his own life .