Generation and maintenance of memory T cells