0

I want to update cached content of one custom table when another custom table item is updated. Let's say I have two Custom Tables: Product and Order. There are List and Edit pages for both Product and Order.

In DB there is a trigger on Product that updates some data on Order if Product is changed.

My scenario is, when I update lets say Product 1(one of the item of type Product), I want Orders (all orders) cache to refresh and reflect changes made in DB for Order. This is not happening right now.

Global settings are 10 minutes for content caching. But somehow it takes 20 minutes to reflect changes. Not sure why. Also on Orders' CustomTableRepeater's System Settings->Cache minutes is set to 0 means it should not be caching content at all but it still does so I am at loss here

Answer to this scenario would be setting cache dependency dummy key as per Kentico documentation.

My questions are:

  1. Do I set dependency key of all orders on Product's edit page's web part partial output cache dependency property?

for e.g. orders|all

Will this refresh all order records cached in for custom table data source when any product is modified?

  1. Or I set dependency key of all Products on orders' repeater's System settings->Content Cache Dependency property?

for e.g. products|all

Please note Cache minutes property is set to 0 so ideally this content should not be cached.

  1. Or add above key to Order's Edit page's webpart's partial output dependency?

Also for custom table how to get proper dummy key? Is it

products|all

OR

nodes|corportateside|products|all

OR

customtableitem.products|all

Or I need to add pages' dummy keys that I can see in debug->cache settings?

I have tried setting up all these things but nothing seem to work. Any help is greatly appreciated.

ReshDev
  • 83
  • 8

1 Answers1

0

Okay so it turned out to be a not cache issue.

I was able to resolve my issue. Putting answer here for future reference I will first list down what I tried:

  1. Installed Hotfix
  2. Add Partial Cache Dependency key
  3. Add Cache dependency key for Content caching. Nothing worked.

Got an idea by reading answer from this questions: https://devnet.kentico.com/questions/kentico-8-2-database-caching

When I was updating CustomTable A's data, in DB trigger on A would update data in table B which I needed to refresh in Site's cache.

When I tried 'Clear Cache' from Debug application from Admin, it still did not update data in Site. Also my Custom Table data in Admin was also not getting updated.

So reading one answer from above question, I realized I need to refresh Hashtables for data to be refreshed in admin and subsequently in site.

So I added code to CustomTableForm.aspx.cs in OnAfterSave event handler. Here I am checking if current CustomTable is my table A, then refresh hashtables of B.

This worked.

ReshDev
  • 83
  • 8