cache theory question

I’m writing a site that must be page-chached. What would the best method be to include a user system. How could you dynamically include the user-name on a page? Should I use Ajax? plain javascript? or something completely different. I would really love to hear how others have handled this problem