# Purging cache

In Marfeel, all cache layers are purged automatically and regularly by µSmint. When necessary, we can force manual purges at different levels.

# µSmint

µSmint is the Marfeel component that is in charge of triggering the purges of the different cache layers when required.

Whenever an invalidation is triggered, either manually or automatically, µSmint purges the following:

  • Fastly (Both edge and shield)
  • M-Shield
  • EhCache (Gutenberg's in-memory cache)

So it guarantees that the content will be up to date at all levels.

µSmint

# Manually purging cache

Before triggering any purge it's important that you verify that cache is your problem, and which layer following the content freshness guide.

If the purge is still needed, first launch an invalidation to trigger a µSmint purge and track the invalidation request to Fastly and the invalidation result.

If the content remains cached, manually trigger the purge:

# Idenfity resources

Use the cache header Surrogate key to identify which resources need to be purged.

To identify a resource's Surrogate-Key run curl -I <resource URL> -H "Fastly-Debug: 1" on the command line and check the Surrogate-Key value.

Click to see a detailed example:
 











 


















$ curl -I https://mejorconsalud.com/salud -H "Fastly-Debug: 1"

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 237776
server: istio-envoy
x-powered-by: PHP/7.3.11
etag: f104d0c2ee8ca93cfe79bd5ffa11ddb6
content-type: text/html;charset=utf-8
x-envoy-upstream-service-time: 34
Surrogate-Key: mejorconsalud.com/salud mejorconsalud.com /salud
MRF-tech: CDN
Accept-Ranges: bytes
Date: Mon, 11 May 2020 08:00:42 GMT
Fastly-Debug-Path: (D cache-mad22041-MAD 1589184043) (F cache-mad22047-MAD 1589184043) (D cache-lhr7344-LHR 1589184043) (F cache-lhr7344-LHR 1589183960)
Fastly-Debug-TTL: (M cache-mad22041-MAD - - 0) (H cache-lhr7344-LHR 217.092 2592000.000 83)
Fastly-Debug-Digest: dac0110d311158b441adfb6fdf88e0a91543ac29935a44c90e9b3d3b1b93c00f
X-Served-By: cache-lhr7344-LHR, cache-mad22041-MAD
X-Cache: HIT, HIT, MISS
X-Cache-Hits: 1, 0
X-Timer: S1589184043.905203,VS0,VE67
Cache-Control: public, max-age=300, stale-if-error=2592000
Vary: Accept-Encoding, User-Agent
X-B3-TraceId: d68d0f33cec04cdf997cdcc450eddf8a
X-B3-TraceId-Primal: 0bc39e94a0514cfd9da872dccb60b333
Mrf-Cache-Status: HM

100  232k  100  232k    0     0  1045k      0 --:--:-- --:--:-- --:--:-- 1045k

In this example Surrogate Key's value is mejorconsalud.com/salud mejorconsalud.com /salud where mejorconsalud.com is the host, /salud the path and mejorconsalud.com/salud the host+path.

The Surrogate key contains three parameters:

  • host + path: Next parameters concatenated.
  • host is the Tenants' domain.
  • path is the path for that resource.

host+path is the value you will need to add to the Jenkins interface to trigger the purge.

M-Shield host exception

If the host is live.mrf.io, (i.e. full path is live.mrf.io/statics/www.mangaforever.net/index/icon.png), you have to exclude the host and purge only /statics/www.mangaforever.net/index/icon.png.

# Candidates

The following items can be purged:

  • Homepage e.g. mejorconsalud.com/
  • Sections e.g. mejorconsalud.com/salud
  • Articles e.g. mejorconsalud.com/intoxicacion-metanol/
  • Static resources e.g. mejorconsalud.com/wp-content/themes/base-deploy/assets/img/lang/es_ES/logo-mobile.svg

WARNING

Never purge a full tenant, since this may cause their origin server to go down due to a huge amount of requests.

# Jenkins job

WARNING

Avoid this procedure when possible. Before doing any manual purge follow this procedure to ensure the error is cache and can't be solved by automatic purges.

There are two possible purges, depending on the layer the resource is cached on:

To manually trigger one of those purges, add the Surrogate key (host+path) in the text box and click on Build.

This will remove the resource from the cache layer so next time is requested Marfeel will fetch it from the origin server.