Setting cache dependencies on class field updates

Laura Frese asked on November 16, 2016 02:46

I am using DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(classname) to get the field names that are associated with a class. I want to cache those field names, which is easy, but cant figure out how to clear the cache data when the fields for that class are modified. I have looked at the Setting cache dependencies documentation but it doesnt provide what I need. Anybody have any brilliant ideas?

Recent Answers


Anton Grekhovodov answered on November 16, 2016 06:29

Hi Laura,

I'm not sure that it's necessary to cache DataClassInfo object, because DataClassInfoProvider uses HashTable inside, which is populated for the first time and is cleared, if class is modified.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on November 17, 2016 16:39

Have you tried to set cache dependency like this:

cms.class|byid|53

Also you may workaround this by dropping your cache item in the following event handler CMS.DataEngine.DataClassInfo.TYPEINFO.Events.Update.After

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.