Add internal modification date
Closed this issue · 5 comments
The goal is to have an internal modification timestamp directly on the namedfile/namedimage.
This makes it possible to use this timestamp for caching/invalidation purposes.
Example:
Currently _p_mtime is used in by the @@images
view in Plone to generate a hash_key for scales.
The issue there is, that the metadata in the catalog is not the same, because the catalog gets updated in a precommit hook and thus still has the old _p_mtime.
With an internal modification timestamp this problem can be solved.
Eventually the @@images
view can be changed to use this new timestamp, in order to generate resp. invalidate new scales.
This is a good idea.
the catalog gets updated in a precommit hook and thus still has the old _p_mtime
Or None
, if it's the transaction where the file is added.
Or None, if it's the transaction where the file is added.
Exactly. This case should be handled as well.
Even further down the road this change will make it possible to have the same hash keys stored in the metadata (ZCatalog) and in the plone.restapi NamedImage serializer.
Would it be OK for you to fire an event when an image field is modified ?
It could help a lot for performances of subscribers in packages like collective.autoscaling or plone.app.imagecropping (see this issue).
Thanks for your inputs 🙏
@laulaz Sure but that sounds like a new feature request, not part of this issue.
OK, I will propose a PR 👍