Caching of last-id. Cleanup.