This is such a tough question. I think you keep a guy for 2 years minimum. Then, by his third year, if he his not playing well enough to reasonably keep you in contention for the post-season, you start to look elsewhere. The problem is, if you have a great team around the young guy, you can hide his deficiencies or at least use the "he's playing well enough to win games" argument, which sort of works. With the salary cap, however, getting a lesser team is almost guaranteed and the wheels come off.
As evidence, I submit the Blane Gabbert's and Mark Sanchez's first two seasons. If Blaine was on NY in 09-10, he would've lasted a lot longer due to the team being so great. If Mark had the same two first seasons on the Jags, he would not have lasted 5 years there.