The customer expires catalog categories under Commerce. We are able to capture the event when the expiry datetime is set to “now” but if the user set expiration to a future date and that date comes, will episerver fire an event?
Hi, no event will be fired. I think you could listen to SavedContent/PublishedContent when expiry datetime is set to now, but there is no "expired" event (and I don't think that will ever be added, for obvious reasons)
What are the obvious reasons for this? We're currently have a main menu cache that contains categories and should be invalidated when a category has expired, so a new cache is built up without the expired category.
If there is an "event" - like when you update/publish/delete a content, it would be easy to fire an event. For expiring you would need to have a service running 24/24 and notify when a content StopPublish time is passed. I would say it is a complex system and is (very) hard to implement.
Whenever you set the expired date that is in the future, you store the date in a table along with the content id. A scheduled job ran ever 1 second checks if any of those dates has been passed and will fire an event? :)
That is one way to do it - to be honest I think about the same thing as well. That can be used as a custom implementation, but as a framework level feature it will need a lot more considerations.