Remembering who may harm you and being ready to defend against such potential enemies is certainly adaptive behavior. Obsessing about revenge is not adaptive, because there is no reward for an animal to do that. Time is better spent finding food, finding a mate, and raising young. Of course, if the same enemy keeps coming back, it would be adaptive to keep fighting it because not defending oneself would be maladaptive. For example, lions and hyenas constantly battle for food, and they fight each other constantly. But that is very different from holding a grudge and constantly obsessing about revenge. Animals who do that are psychopathic, and psychopathic behavior is usually eliminated by natural selection.Defensive behavior is adaptive. Seeking revenge to please one's psychopathic brain is labeled spiteful behavior. Since spiteful behavior is defined as behavior that harms both oneself and one's enemy, it is very rare in nature, much rarer than cooperative behavior (acts that benefit both parties), selfish behavior (acts that benefit one party but harm the other), and commensalism (acts that benefit one party but do no harm to the other), for example.
Animals violently react to the situation and remember within a time frame but I do not think it retains memory of the violator. We have seen many footages of Television of Elephants revenge like act and attacks of tigers in captivity (Zoos) onits care taker.
Research "orca human cooperation". There is a very interesting true story from Australia about a fishing village that developed a cooperative arrangement with a pod of Orca. It describes events which address your question.
revenge is a human concept.
no