• Blog >
  • Cti digital launches magento 2 cache permissions module

TL;DR

Today we have released an advanced cache permissions module which provides Magento Administrators with the ability to define which users in an organisation can both view and manage 'Cache Types' at a granular level. 

You can access the module via CTI Digital's GitHub account.

Why we wrote this module

The Magento 2 platform offers a wide range of performance benefits to online retailers running high transactional commerce stores and introduces several new technology improvements in order to ensure your site is optimised to respond quickly to users requests.

One of the techniques Magento uses to achieve the above is the usage of several 'cache' layers which cache pages and operations requested by users. 

By leveraging a 'cache', responses can be returned to the user in a more efficient manner which ultimately leads to quicker execution times leading in faster page load speeds. 

A primer in Cache Management

Magento 2 is similar to Magento 1 in that it defines multiple 'Cache Types' which can be seen and flushed from the Admin Panel via System -> Cache Management.

Screen Shot 2017-09-26 at 17.24.15.png

Figure 1.0 - The Cache Management Section of a Magento 2 Admin Panel.

Cache Invalidation

When making changes to the Magento platform via the Admin Panel administrators will cause caches to be 'invalidated'; at which point the following message will be displayed with an action to visit the 'Cache Management' section of the Admin Panel and refresh the offending 'Cache Type'.

Screen Shot 2017-09-26 at 17.32.05.png

Figure 2.0 - The Cache Management Section of a Magento 2 Admin Panel.

Should the user click on the action to visit the 'Cache Management' section or load it from the navigation panel via System->Cache Management the list of offending 'Cache Types' will be displayed with an associated status message. 

  • Valid Cache Types are displayed in Green and show the status of 'Enabled' showing that the cache type is both enabled and the information being served from this 'Cache Type' is the most current version.
  • Invalidated Cache Types are displayed in Orange and marked as invalidated in order to indicate that the cache is now 'stale' (outdated) and needs to be refreshed in order to display the latest changes to the user.
  • Disabled Cache Types are displayed in Red indicating that no data is being cached for this associated Cache Type.

Screen Shot 2017-09-26 at 17.34.52.png

Figure 3.0 - The Cache Management Section of a Magento 2 Admin Panel showing invalidated cache types.

Why so many Cache Types?

The reason Magento defines multiple 'Cache Types' and provides visibility into to the cache status of each type is so that users only clear the 'Cache Types' that are invalidated thus keeping the maximum amount of information in the cache and having the minimal impact on site performance. 

On the Cache Management setion of the Magento Admin Panel you will notice that each 'Cache Type' has its own corresponding checkbox which allows admin users to select either one or multiple cache types and run the defined action on them that is displayed in the 'Actions' drop-down. When clicking on the Grey 'Submit' button on the left-hand side of the screen the associated Action is performed on the selected cache types.

Available action options are: 
  • Enable - Used to enable the 'Cache Type'
  • Disable - Used to disable the 'Cache Type'
  • Refresh - Used to refresh the 'Cache Type'

But what about those big Orange and Grey Buttons?

Due to the visual hierarchy of this page, it's not unreasonable for admin users to assume that they should be selecting either one of the 'Flush Magento Cache' or 'Flush Cache Storage' options as the visual hierachy for the page would lead you to believe that these are the primary actions for this page. 

However, both of these actions are far more obtrusive and will clear each of the defined cache types regardless of if the cache is invalidated or not.

The subsequent result of this action is that Magento will need to re-create all of its cache types causing an increased load on PHP and MYSQL operations resulting in a significantly longer page load speed until the cache is re-generated.

Enforcing a Cache Flushing Policy

As a general precaution, retailers should look to either avoid or minimise cache flush operations during peak load / peak sales periods in order to ensure that site performance is not degraded.

A problem of Access Control

Defining a 'Cache Flush Policy' is a great starting point for ensuring that users both understand Magento's cache types and minimise flushing activity. However, as businesses grow and introduce new team members the learning processes needs to begin again.

Introducing Granular Cache Management Permissions

Today we are releasing a 'Cache Permissions' Module which has been developed in order to extend Magento's access control permissions allowing website administrators to control what level of Cache Flush commands a given user can perform.

advanced_acl_options.png

Figure 4.0 - A Screenshot showing the advanced cache options provided by the CTI Cache Permissions module.

Accessing and installing the module

As of today, you will be able to find this module on CTI Digital's GitHub account. The module is provided under the MIT License which allows users to access, download, install and modify the module free of charge.

Our commitment to Open Source

As a company that leverages open source technologies CTI Digital is committed to contributing back to our communities where possible. If you would like to find out more about CTI Digital's open sourced modules please visit our GitHub account.

● ● ●