I think what you are after is the memory scholars of old had.
It is reported that Imaam Shaafi'ee had to cover up a page when he would be memorising so that he would not memorise the wrong page by mistake.
He also took the book of Imaam Maalik, al-Muwatta, and memorised it in one night, Imaam Maalik said you memorised a book that took me 20 years to write.
Imaam Zuhri had to put cotton in his ears if he ever went to the market so that he wouldnt memorise peoples conversations by mistake.
Imaam Abdullaah bin Mubaarak was asked do you memorise hadith? Where upon his skin colour changed and he replied no, I look inside [the book] and whatever I wish stays with me.
Imaam Ahmad bin Hanbal memorised at least one million hadith by heart.
Imaam Bukhaarees memory was so sharp that when the people in Baghdaad tried to trick him by mentioning hadiths with mixed up chain of narrators he ended up correcting them.
So what gives these people this amazing ability? Well obviously it is a blessing and a test from Allah, to see if they are grateful [i.e use it for good] or ungrateful. One of the main ways to improve ones memory is to stay away from sin, I realise people might think yeah yeah we already know that! But honestly try it and you will soon see that things will improve.
Also keep repeating whatever you want to memorise, it was narrated that a scholar from the past once sat and repeated a few couplets of arabic poetry, an old lady sat abit far from him but she over heared him and after awhile she said enough! Even I, an old lady has memorised it by now. But the scholar didnt pay attention to it rather he carried on. After a few days he met the lady again and asked her to repeat the couplets to him she replied I have forgotten it whereupon the scholar said this is the difference between you and me. [i.e he kept repeating it so it stayed with him]
Photographic memory is a blessing from the all-Mighty, yet if you do not have it, that doesnt mean you cant improve your memory or make the most of what you have.
Make dua that Allah grants you a strong memory.
Also chewing gum helps.