I'm using the ShareThis module to power my sharing links on a Drupal 7 site, but I don't think my question is specific to this module.
I want to modify the link that's shared and sharethis provides a theme_sharethis() function where I can override the output. I have mytheme_sharethis() in my template.php file where I modify the output as required. On my dev box (where I have disable caching) this works fine.
We're using Memcache and Varnish modules for pretty heavy site caching.
Quite often, when new content is created (and in some cases older content is viewed) my theme function, which changes the urls, is ignored. It gives the default share this links instead of my custom url patterns from the theme function. It does this for both logged in and logged out users.
If I clear caches multiple times, eventually it recognizes the theme function and gives the proper link. Obviously I want it to use the correct link the first time!
I suppose my question starts by asking which cache (Drupal, Memcache, Varnish) this is likely occurring in (I think I know the answer, but want to confirm). The obvious next question is how I get it to recognize my theme function every time without clearing the caches first.