Forums / Developer / related object cache not cleared when adding location

related object cache not cleared when adding location

Author Message

Marko Žmak

Tuesday 26 July 2011 6:58:56 am

This is the situation...

I have enabled:

ClearRelationTypes[]=reverse_attribute

I have an object called "Blog frontpage" that has an object relation attribute "Map of authors". This attribute is connected to a folder called "AUTHORS".

I have a user group with users. When I go to a user and add him to the folder AUTHORS (with "Add Location"), the cache for "Blog frontpage" doesn't get cleared (while it should).

And when I (for the same user) remove the "AUTHORS" location, the cache does get cleared.

Is this a bug and can someone confirm it's happening?

I'm using eZP community 2011.6

 

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Gaetano Giunta

Tuesday 26 July 2011 11:56:22 am

"When I go to a user and add him to the folder AUTHORS (with "Add Location", the cache for "Blog frontpage" doesn't get cleared (while it should)."

Not sure it should expire. You're not modifying the object that is related to your blog, but one of its children...

I am in fact more surpries about the cache getting cleared when you remove the user from teh AUTHORS folder ;-)

Principal Consultant International Business
Member of the Community Project Board

Marko Žmak

Wednesday 27 July 2011 1:20:12 am

"

Not sure it should expire. You're not modifying the object that is related to your blog, but one of its children...

I am in fact more surpries about the cache getting cleared when you remove the user from teh AUTHORS folder ;-)

"

I suspected I would get an answer like this... :)

But, look at this logic:

  • when I add a user under AUTHORS I'm changing something about this user object so this triggers the cache clearing mechanism for the parents of the user
  • since the AUTHORS now is a parent of the user object, it's cache clearing mechanism is tiggered
  • and since I enabled reverse_attribute clear relation type, the cache clearing for AUTHORS should trigger the cache clearing for the Blog frontpage

It sounds logical to me...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Gaetano Giunta

Wednesday 27 July 2011 6:18:22 am

But you need to take into account recursion: if you expire the cache of the parent node in a recursive manner, he will expire his own parent and so on...

I'm not really sure this is clear cut, but whenever a node (other than the currently edited one) is expired based on either standard expiry rules or smart view cache ones, eZ does not recurse cache expiration.

Principal Consultant International Business
Member of the Community Project Board