Adapted from the Stephen King novella " Rita Hayworth and Shawshank Redemption " , the film tells the story of Andy Dufresne , a banker who spends 19 years in Shawshank State Prison for the murder of his wife and her lover despite his claims of innocence .