# Invalidation

MarfeelPress detects any events related to content modification by using Wordpress Hooks (opens new window). Every time there is a content change, either a new article or an article update, it will call our Invalidation API via Insight's DIY service.

Several invalidations are triggered sequentially: first for the updated article, then for the home section, and finally, for each one of the categories, the updated article belongs to.

For each call, Gutenberg producers request the needed content to MarfeelPress, which will, in turn, fetch it from WordPress DataBase, transform it into the required JSON format for our Press Extractors, and send it back.

As Gutenberg doesn’t crawl raw HTML, the extraction process (from receiving content to saving to Marfeel’s database) is much lighter compared to non-press extractions.

This way we obtain a highly efficient system that instead of constantly checking our customer’s servers for new content, relies on WordPress to detect whenever an update is made.

µSmint

Whenever Invalidation API is used, all Marfeel cache layers are purged providing fresh content to the end-user in a matter of seconds since publication time.

The purge service triggered by the Invalidation API is µSmint.

sequenceDiagram

participant Blogger
participant Wordpress as Wordpress Origin
participant MarfeelPress
participant Insight
participant Producer as Gutenberg Producer
participant MongoDB
participant µSmint

Blogger->>Wordpress:new_content()
Wordpress->>MarfeelPress:on(new_content)
MarfeelPress->>Insight:InvalidateArticle
MarfeelPress->>Insight:InvalidateHome
MarfeelPress->>Insight:InvalidateCategories
Insight->>Producer:invalidate
Producer->>MarfeelPress:api.getContent()
MarfeelPress->>Wordpress:getContent()
Wordpress->>+MarfeelPress:content
MarfeelPress->>MarfeelPress:transform
MarfeelPress->>-Producer:contentJson

Activate Producer
Producer->>Producer:boiler()
Producer->>Producer:whitecollar()
Producer->>MongoDB:save
Producer-->>Insight:purge()
Deactivate Producer

Insight-->>µSmint:purge()
Activate µSmint
µSmint-->>µSmint:purgeCacheLayers
Deactivate µSmint

WARNING

Category invalidations only work for sections defined in the tenant’s definition.

# Content retrieval

The content can be retrieved from two 2 different endpoints, at least one of them must be accessible for a successful extration.

# Extractor types

MarfeelPress-enabled sites are extracted using BoilerpipePressExtractor v.1.0 for articles, and MarfeelPressRipper v.1.0 for sections.

# Scheduled Posts

MarfeelPress by default uses the publication time of a post to invalidate it for the first time, thus replicating the behavior of scheduled posts in the Marfeel version of the tenant.

# Full site extraction upon activation

MarfeelPress invalidations system works only if the plugin is activated. Whenever a publisher clicks on the ACTIVATE button, a full site extraction will follow.

This is done to ensure that:

  • For first-time activations, all the necessary content is extracted to fill all sections.
  • For re-activations there's no method to know which content updates have taken place while the tenant was not active, therefore, an extraction of the full site is required to make sure the Marfeel version is up to date.