Dogs do have long-term memories, especially about those whom they love. Cats remember things that are important in their lives. Some cats seem to have extraordinary "memories" of certain locations. Cats that are taken far away from their homes, for instance, have an uncanny ability to find their way back.
The key to a cat's "homing" ability may be a built-in celestial navigation system (using the sun, moon, and stars as a compass), similar to that of birds. Alternatively, the navigational ability of cats could be attributed to their sensitivity to the Earth's magnetic fields. It has been shown that when magnets are attached to cats, their homing instinct is disrupted and they are unable to find their way.
Sources: Fox, Michael W. The Animal Doctor's Answer Book, p. 215; Schneck, Marcus, and Jill Caravan. Cat Facts, pp. 20-21.