Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • webmonger 130 posts 285 karma points
    Apr 25, 2012 @ 18:34

    CacheByPage and umbraco:macro using filelocation not alias name


    I've got a site setup using macros and razor but when I switch caching on for the macros initially they all got confused.

    I realised that the key for caching is the alias name so for each macro included on a page I added an alias and they all started behaving again.

    Unfortunately I then found that each macro only got cached when first processed so if a macro was used throughout the site and it was first created on the home page the bread crumb would only ever show as if it was on the home page.

    I researched and worked out that in the backoffice there is an additional setting Cache By Page which i had not added in my macro include.

    I attempted to add an attribute CacheByPage="true" however this does not seem to work.

    Does anyone know how to make macros using filelocation cache by the page?


  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Apr 26, 2012 @ 11:26
    Sebastiaan Janssen

    Sorry, I have no idea, I hardly ever use caching because my sites are wonderfully fast already. But it sounds like a bug if it doesn't work.

    Also, I'm not sure know what the exact attributes are so you might want to dive into the source to check if it exists and if you didn't misspell it.

    So my only advise for now is: Create a proper macro and set check ON Cache by Page there.

  • webmonger 130 posts 285 karma points
    Apr 26, 2012 @ 12:16

    Thanks Sebastiaan

    I've had a dig in the code and in the macro.cs there is no reference to Cache By Page which is a bit of a pain.

    Unfortunatley when you're calling external sources you can't control how fast they respond with the data so caching is the only option for this :(

    I'll try and find time to log this on the Issue tracker and maybe edit the code so it works.

  • Steve Smith 75 posts 158 karma points
    Apr 27, 2012 @ 13:22
    Steve Smith

    Hi Jon,

    The release notes for today's Umbraco 4.7.2 release mention "patch release fixing several bugs including major issues with Razor caching".  Might this have fixed the problems?



Please Sign in or register to post replies

Write your reply to: