Copied to clipboard

Flag this post as spam?

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


  • Jonathan Cohen 40 posts 115 karma points
    Sep 29, 2011 @ 19:15
    Jonathan Cohen
    0

    Cache By Hostname

    Hi,

    A question regarding cache.

    I have a multi hostname site, and i like to only load the meny once / hostname. In the macro cahce section you can choose, "By Page", "Cache Personalized" and set a duration. But i would like a third option - "By Hostname"...

    If a Cahe by page we do a lot of roundtrips extra and fill upp more memory, if I do a cache for the whole thing, the difrent sites get the same menu.

    How can I get this to work, can I extend the cache handling, without breaking core. Or do I need to handle this in my usercontrols.

    Any point in the right direction would be nice.

    /Jonathan

     

  • Rodion Novoselov 694 posts 859 karma points
    Sep 30, 2011 @ 07:16
    Rodion Novoselov
    1

    I'm not sure that's feasible in Umbraco itself, but as a quick solution you can just create the second virtual site then set its root folder to the same as your original site and set up network bindings so that each site to handle requests for a particular host name. Actually, you will have stuff very similar to load balancing, but where each node is dedicated to its own host header. Since every site will have its own cache you will have per-hostname caching.

  • Rodion Novoselov 694 posts 859 karma points
    Sep 30, 2011 @ 08:01
    Rodion Novoselov
    0

    Another more advanced but complicated option could be creating a custom cache provider for ASP.NET that will separate stored cache items by the host header of the current request or probably some additional criteria. You can get sample of implementing a custom cache provider for example here: http://msdn.microsoft.com/en-us/magazine/gg650661.aspx

  • Jonathan Cohen 40 posts 115 karma points
    Sep 30, 2011 @ 08:28
    Jonathan Cohen
    0

    Thanx Rnovoselov for your reply,

    The first solution I have tested - Multiple sites in IIS pointing to the same physcal web, and then set manage host names in Umbraco...

    But then I got issues with the Xml Cache for content when publishing.

    Have you got that working, anything you could think of that I missed?

    /Jonathan

  • Rodion Novoselov 694 posts 859 karma points
    Sep 30, 2011 @ 09:14
    Rodion Novoselov
    0

    I haven't tried it on my own, actually, but at a quick glance into umbraco's sources it seems that there's nothing special about macro caching - it does use a usual HttpCache object to do it, so, in my opinion that's supposed to work well. Could your explain in bit more details what issue your got exactly?

  • Jonathan Cohen 40 posts 115 karma points
    Sep 30, 2011 @ 09:29
    Jonathan Cohen
    0

    Hi again,

    Fiddled around a bit, and got it woking perfektly.

    What happend if I was logged in admin on one host and updated the other the cache was not updated and vice versa.
    In umbracoSettings.Config I needed to set up the host/ip for distributed calls and set it to enabled

    Thanx for pointing me in the right direction...

    <distributedCall enable="true">
        <!-- the id of the user who's making the calls -->
        <!-- needed for security, umbraco will automatically look up correct login and passwords -->
        <user>0</user>
        <servers>
          <!-- add ip number or hostname, make sure that it can be reached from all servers -->
          <!-- <server>127.0.0.1</server>-->
    <server>firstHost</server>
    <server>secondHost</server>
        </servers>
    </distributedCall>
Please Sign in or register to post replies

Write your reply to:

Draft