Incorrect. Background investigations are good for 5 years. That tells security what clearance level you are eligible to receive. A clearance is granted on need to know basis and can, and is usually, revoked as soon as you no longer need to know.
Actually, what you’re saying is incorrect. Your clearance isn’t “revoked” simply because you leave a job. It will be inactivated, but NOT revoked.