Talented dogs can remember the names of their toys for at least two years, scientists have found.