Introduction about Magento 2 Cache :
What is Cache in Magento :
A collection of data stored in a hidden or inaccessible place in a computing environment called cache . Cache is frequently used by cache CPU, applications, web browsers (or) OS. Cache management is one of the way to improve the website performance and better/faster of the magento store.
Properties of Cache :
- Latency
- Capacity
- Availability
How it work’s:
Based on the request and response, the data will be served from cache if the content or page was already cached else the request will be hit the files and Database server to get the output. If we keep on hit the server for every request to the output than the network bandwidth may increase. And there is a chance to get website slow due to high network calls/request.
General Terms of Cache algorithm :
A Cache algorithm is commonly used for managing or handling the data in cache system. When the cache memory is full than the cache algorithm will decides which item should be delete from the cache. Below are the some basic cache algorithm,
Least Frequently Used (LFU) – The lowest count item will get removed at first from cache.
Least Recently Used (LRU) – Lease recently visited item gets remove at first from cache.
Most Recently Used (MRU) – More recently accessed or visited items get removed (Mean, older items are still persist in cache)
Pseudo-Least Recently Used (PLRU) – Using of Least Frequently Used is little tricky to use in such cases we can use PLRU. Adaptive Replacement Cache (ARC) – Always ARC is common between Least Recently Used and Least Frequently Used to improve combined set.etc..
For more Info please visit: https://en.wikipedia.org/wiki/Cache_replacement_policies
Types of cache in Magento :
Go to following menu path in your store admin ,
admin – System – Cache management – Cache Grid.
In this section you can see the list of magento cache types and that cache type is on currently available with active or deactivate mode. Also you can clear or flush the magento cache using submit action button (See the cache clean & flush button)
Detailed cache types are available with below link :
https://jutesenthil.wordpress.com/tag/different-types-of-cache-in-magento/
(Note : Below link the given screenshot is for M1, but the descriptions is common for M1 and M2)
Clear cache Using Command Line : Using command line
php bin/magento cache:clean or php bin/magento c:c
php bin/magento cache:flush or php bin/magento c:f
Note: Few more useful cache command are available to use in command line.
For More Infor refer :https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/cache_for_frontdevs.html