Monday, February 15, 2016

Cache Types in Magento 2

Current version of Magento 2 works with following types of Caches:


  1. Configuration (config) cache:
    This cache appears when Magento gathers configuration from all its modules, merges it, and saves to the cache. Additionally, it includes store-specific settings from the file system and database. You should flush or clean this type of cache after changing configuration files.
  2. Layout (layout) cache:
    This consists of compile page layouts. This cache requires flushing layout files.
  3. Block HTML output cache (block_html):
    This one is about HTML fragmanets per each block. Clear this cache after changing the view layer.
  4. DDL cache (db_ddl):
    This is about database schema. It can be clean up automatically as well. It is posible to put any data in any segment of db_ddl cache. Cache should be flushed after custom changes to DB schema.
  5. Entity-attribute-value (eav) cache:
    This cache includes Meta-data related to EAV attributes.
    Ex:
    Store labels, search settings, attribute renderings etc.
  6. Full page cache (full_page):
    This occurs due to generate of HTML pages. It is automatically clean by Magento an can be modify by third party developers.
  7. Translations cache (translate):
    This consists of translations from all modules.
  8. Integration configuration  cache (config_integration):
    This is related to compiled integration. Clean this after adding new integration or modifying existing ones.
Web services configuration cache (config_webservice): Cache of the web API structure.

Pre-requisites:
- Go to bin folder
> cd <amagento_root>/bin

- To check the cache status:
> magento cache:status

- To enable / disable cache types
> magento cache:enable [cache_type]
> magento cache:disable [cache_type]

- To clean the cache
> magento cache:clean [type]

- To flush the cache
> magento cache:flush [type]

Cache types:
layout
block_html
collections
db_ddl
eav
full_page
translate
config_integration
config_integration_api
config_webservice



Tuesday, February 9, 2016

Add Column to existing Table

Table Name: ism_storelocator/location
Setup Script name: mysql4-upgrade-1.0.10-1.0.11.php
<?php$installer = $this;

$installer->startSetup();

$installer->getConnection()->addColumn(
    $this->getTable('ism_storelocator/location'),
    'default_url',
    'varchar(200)');

$installer->endSetup();