Copied to clipboard

Flag this post as spam?

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


  • Mark Bowser 273 posts 860 karma points c-trib
    Jun 12, 2014 @ 02:11
    Mark Bowser
    0

    Cannot disable courier cache

    I'm trying to get a contour provider for courier working on umbraco 6.1.2 with courier 2.7.8.35, and contour 3.0.17

    I'm being thwarted by the courier cache. Right now, the provider can't pick up updates to contour forms. In some courier documentation I found my problem in the list of Common Issues:

    https://github.com/umbraco/Courier/blob/master/Documentation/CommonIssues.md

    The documentation addresses the issue like this:

    Latest changes are not deployed / courier cant detect changes
    
    Caused by: When changes are made, courier stores a serialized copy in its cache folder, in some cases, it cannot update the filem due to permissions or locks
    
    How to spot find the corresponding item in /app_data/courier/cache and see if it changes on save/publish
    
    Solution: Clear the /app_data/Courie/cache folder and retry packaging, in some cases caching might need to be turned off this will make transfers slower, but can be set in /config/courier.config file
    

    I've been trying to disable the cache via the courier.config file to no avail. I've even tried deleting the Umbraco.Courier.CacheHandler.V4 / V6 dlls. The cache is unstoppable.

    How do I disable the courier cache? It would be even cooler if I could tell it to only avoid the caching of specific providers. Is there an out of the box solution for disabling the courier cache?

    Thanks!

  • Mark Bowser 273 posts 860 karma points c-trib
    Jun 13, 2014 @ 00:43
    Mark Bowser
    0

    So far, I've been unable to disable the entire cache (and I'm not so certain that I actually want to anymore). What I do want is the ability to be able to disable caching of a single provider.

    <cache>
      <enable>true</enable>
      <locations>
        <add path="everything">
          <provider id="*" />
        </add>
      </locations>
    </cache>
    

    It turns out that the enable tag does basically nothing. The Umbraco.Courier.Core.Cache.ItemCacheManager that handles the caching has a method like this:

    public List<string> CacheLocations(ItemIdentifier id)
    {
        List<string> list = new List<string>();
        string str1 = id.ProviderId.ToString();
        if (Settings.EnableCaching && this.IsCacheable(id))
            list.Add(this._root.ToLower());
        if (ItemCacheManager.m_cacheProviderConfig != null)
        {
            foreach (XmlNode xn in ItemCacheManager.cacheProv.SelectNodes(".//add [provider/@id = '*' or provider/@id = '" + str1 + "']"))
            {
                string str2 = xn.Attributes["path"].Value.ToLower();
                if (!list.Contains(str2))
                    list.Add(str2);
            }
        }
        return list;
    }
    

    It first checks to see if we have enabled caching. If we have not enabled caching, it checks to see if we have included caching by specifying locations. Specifying the provider id of '*' will allow all providers to be cached. Specifying a specific provider GUID will allow that specific provider to be cached. However, there appears to be no way to specify a specific provider to be ignored from the caching. So far, my changing the location path has had no effect.

    Furthermore, configuring courier like this:

    <cache>
      <enable>false</enable>
    </cache>
    

    Still just caches everything. I'm not sure why yet. Based off of the courier core code I pasted above, I would have expected none of the providers to be cached because there were no locations and the cache was disabled. I've probably just been looking at this for too long.

Please Sign in or register to post replies

Write your reply to:

Draft