1

We are on SDL WEB 8.1.1 CU 1, DXA Version 1.6

We have a dynamic news section on our website.

These news items are queried from broker at runtime and returned. The call is through a controller action method and data is returned in JSOn form.

The situation we are having is as described below:

1.) When changing content of an existing NEWS item, and publish, changes reflect immediately. No issues here.

2.) When creating a new NEWS item , publish it, the new NEWS item does NOT appear on the website immediately. It takes hours to reflect on the website.

We have checked the storage config of microservices and see the <objectCache> is enabled. Remote syncronization is also enabled and working fine.

The website has DXA caching enabled with key: service-caching set to true.

I have tried using the [NoCache] attribute on my Action method of the controller, but the results are still cached.

Any guidance here to bypass DXA cache will be helpful.

NOTE: [NoCache] attribute is defined at path: sdl.web.mvc\controllers\NoCacheAttribute.cs file of Dxa framework code

Controller Action method implementation:

string NewsSchemaId = WebRequestContext.Localization.GetConfigValue("core.NewsSchemaId").EmptyOrValue();
string NewsTemplateId = WebRequestContext.Localization.GetConfigValue("core.NewsTemplateId").EmptyOrValue();
BrokerQuery query = new BrokerQuery();
var itemURIs = query.getComponents(int.Parse(NewsSchemaId), int.Parse(NewsTemplateId));

Below is the BrokerQuery class implementation:

 public class BrokerQuery
    {
        public string[] getComponents(int schemaid, int templateId)
        {
            Criteria criteria = BuildCriteria(schemaid, templateId);
            global::Tridion.ContentDelivery.DynamicContent.Query.Query query = new global::Tridion.ContentDelivery.DynamicContent.Query.Query(criteria);
            string[] itemURIs = query.ExecuteQuery();

            return itemURIs;
        }

        private Criteria BuildCriteria(int schemaid, int templateId)
        {
            List<Criteria> children = new List<Criteria> { new ItemTypeCriteria(16) };
            if (schemaid > 0)
            {
                children.Add(new ItemSchemaCriteria(schemaid));
            }
            if (int.Parse(WebRequestContext.Localization.LocalizationId) > 0)
            {
                children.Add(new PublicationCriteria(int.Parse(WebRequestContext.Localization.LocalizationId)));
            }
            if (templateId > 0)
            {
                children.Add(new ItemTemplateCriteria(templateId));
            }           
            return new AndCriteria(children.ToArray());
        }
    }
  • Can you provide more information about how your custom action is implemented? – Rick Pannekoek Apr 22 at 19:43
  • @RickPannekoek Added the implementation details of Controller action method. Please check. As you may notice, There is NO asp.net caching used. simple query directly to broker every time – Arvind thiag Apr 23 at 16:59
  • Doesn’t look like the entire implementation; what happens with the URIs returned by the Broker Query?. – Rick Pannekoek Apr 23 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.