Hamsters have fairly good spatial memories and can remember changes in daylight for several weeks. Anecdotal evidence indicates that hamsters can remember familiar humans for months or even years.
Although it is difficult to quantify exactly how long hamsters can store memories, research indicates that spatial memory is an important part of their food foraging. When placed in a maze, they remember which branches had food and tend to explore those first even after several weeks. Hamsters use changes in the length of days to cue breeding, and researchers discovered that they can remember daylight changes for two to three weeks. Sudden disruptions of their circadian rhythms by changing light patterns affect their memories.