When long-term learning depends on short-term storage