Cache Sharding

Edgemesh® Server incorporates a sophisticated cache hierarchy to deliver tailored optimizations based on each browser's capabilities. This ensures that every user receives the best possible performance enhancements that their browser can support. To further optimize the cache, Edgemesh® Server utilizes specific cookies that help shard the cache and differentiate user experiences.

The platform plugin running on your site, such as the Shopify Plugin, plays a crucial role in determining these cache-sharding cookies. For instance, in the case of the Shopify Plugin, the cache is automatically sharded based on cookies like cart_currency and localization. This dynamic approach ensures that each user's shopping cart and localized content are efficiently managed and optimized.

Additionally, Edgemesh® Server provides you with the flexibility to define your cache shards using the em_cache_shard cookie. This allows you to customize the cache sharding based on your specific requirements and configurations. Through the intuitive Edgemesh® Portal, you can easily configure and fine-tune the cache sharding settings, enabling you to optimize the caching strategy according to your website's needs.

The cache shard cookie em_cache_shard should be reserved for dynamic content that applies to groups of users. For example, if you have product pricing based on loyalty tiers, the value of the em_cache_shard cookie can be the name of the loyalty tier. If your dynamic content is specific to an individual user, a dynamic fragment is a better solution.

Set the Cookie Client Side
document.cookie = 'em_cache_shard=pro;max-age=86400'

Here is an example of setting the cookie server side. This will vary by language. The below example is a pseudo example using javascript as the language.

Set the Cookie Server Side
return new Response(body, {
status: 200,
statusText: 'OK',
headers: {
'Set-Cookie': 'em_cache_shard=pro;max-age=86400'
}
})

The ability to define these cookie shards will soon be added to the Edgemesh® Portal with the upcoming release of Edge Routing.

Made withby Edgemesh Corporation