1

I'm building a music application in Symfony 1.4 Doctrine 1.2. I'm using slots to customize the facebook api metatags in my layout header. For example, when I browse a song page, the showSuccess for the song will have a slot like the one below, that populates the layout header meta tags with dynamic information depending on what song it is.

<?php slot('fb_metaproperty_title') ?>
<meta property="og:site_name" content="abc"/>
<meta property="og:title" content="<?php echo $songs['song_name'].' by '.$songs['full_name'] ?>"/>
<meta property="og:type" content="song" />
<meta property="og:description" content="This song is currently ranked <?php echo $songOverallRank?>th" />
<meta property="og:url" content="<?php echo $linktosongpage ?>"/>
<meta property="og:image" content="<?php echo $images[0]?>"/>
<?php end_slot() ?>

The problem is I have cache is turned on and the $songOverallRank variable is cached in the slot so that rank value is out of date (as it changes often). The same $songOverallRank variable is up to date in the code directly below (but outside of) the slot. Just the slot values are cached and out of date for some reason.

I checked symfony documentation on how to manually remove cache values and it seems pretty cumbersome.

Is there a simple configuration or way to just disable the cache for slots? Is there a solution to make sure the slot isn't cached and the variables are pulled exactly the same as the rest of the template (which has up to date values)?

I'm using sfMemcacheCache for view_cache/results_cache and APC for sfPatternRouting cache if that helps.

j0k
  • 22,600
  • 28
  • 79
  • 90
frankp221
  • 175
  • 3
  • 11

1 Answers1

0

I found the cause of the issue. It was not the slot that was cacheing values. It was actually Facebook that was caching the meta tag information. The slot was providing up to date values but facebook meta tag was just showing old data in facebook. In order to clear the cache of the facebook meta tag, I had to type in the link into the facebook debugger (linter) manually.

Typing in each link manually to clear the cache is not a scalable solution so I decided not to put dynamic data inside the facebook meta tag.

More of a work around than a solution. Would love to know how to automatically clear the facebook cache on demand.

frankp221
  • 175
  • 3
  • 11