It's a fine movie, agreed. The movie's focus isn't on revenge, but on the interaction between the protagonists. Anyways, the story outline heavily reminds me of the classic "The Count of Monte Cristo" by Dumas.
Disclaimer: I never read Stephen King's original short story, on which the movie is based, so I cannot say how this compares to Dumas' classic. https://en.wikipedia.org/wiki/The_Count_of_Monte_Cristo
There’s a scene in the movie directly acknowledging this when they are sorting the books for the expanded library. Heywood calls it the Count of Monte Crisco by Alexandree Dumbass and Andy says it’s about a prison break. Heywood then suggests it should go in the educational section.