I'm experimenting with asynchronous loading objects to speed up drupal. For this, I'm using the authcache module, together with ajaxify regions. So far, I've come a long way by adding regions on the node page, and load blocks to the region with ajaxify regions. This has got me almost all the way with great speed and only a little lag for the loaded blocks. The problem I have is with the flag module. It uses tokens for it's links. Each token can only be used by one users, if another user use the same token, it would produce an error message saying that the token is invalid. This is exactly what happens with authcache, since the whole page is cached, including tokens. For the node, I solved it with a block and node_load. When the block is loaded with ajax regions, the new token for a flag is generated. Unfortunately, there's no comment_load, and I want flags in comments as well.
The authcache module already has a function and javascript to refresh form tokens. This leads me to believe that it should be fairly easy to figure out how to refresh other tokens as well. Either that, or look at the ajaxify regions module and use the same method for flag links instead of blocks. Unfortunately, a lot of php and javascript still looks like greek to me, so I'm having a hard time figuring it out. I'd greatly appreciate if someone more cunning could give me a few pointers and/or explanations to how authcache and ajaxify regions refreshes tokens.