Copied to clipboard

Flag this post as spam?

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


  • Salomons 15 posts 107 karma points c-trib
    Jul 18, 2018 @ 07:03
    Salomons
    0

    Customer price by ProductVariantDataModifierTaskBase is being cached

    Good day,

    I successfully implemented my own ProductVariantDataModifierTaskBase class to handle customer based prices, the way described in this post: https://our.umbraco.com/projects/collaboration/merchello/merchello/73758-how-to-implement-this-type-of-discounts

    The problem is that the prices are being cached (i think), I notice that the PerformTask is reached once for each product, I assume that the values are being cached, because the PerformTask function is not called after the initial call, only when I restart application or save some products. That's not the desired situation, because in that way other users are getting the same prices displayed.

    Is there some way to disable the cache for the datamodifiers? Is there another way of modifying the prices throughout the whole site.

    Many tanks in advance.

  • Salomons 15 posts 107 karma points c-trib
    Jul 25, 2018 @ 09:16
    Salomons
    0

    Update ----

    I disabled the cache in the VirtualContentCache, so the DataModifierTask is always called, it's a dirty sollution, please help if there is another way.

    --

          /// <summary>
            /// Gets the virtual content by it's unique key.
            /// </summary>
            /// <param name="key">
            /// The key.
            /// </param>
            /// <returns>
            /// The virtual <see cref="IPublishedContent"/>.
            /// </returns>
            public TContent GetByKey(Guid key)
            {
                var cacheKey = GetCacheKey(key, ModifiedVersion);
    
                //var content = (TContent)_cache.RuntimeCache.GetCacheItem(cacheKey);
                //if (content != null) return content;
    
                return _fetch != null ? 
                    CacheContent(cacheKey, _fetch.Invoke(key)) :
                    default(TContent);
            }
    
Please Sign in or register to post replies

Write your reply to:

Draft