Download the PHP package ecomdev/magento-psr6-bridge without Composer
On this page you can find all versions of the php package ecomdev/magento-psr6-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ecomdev/magento-psr6-bridge
More information about ecomdev/magento-psr6-bridge
Files in ecomdev/magento-psr6-bridge
Package magento-psr6-bridge
Short Description A bridge between Magento framework and PSR-6 cache compatible libraries.
License OSL-3.0
Informations about the package magento-psr6-bridge
Magento 2.0 PSR-6 Bridge
This small module is a bridge, that allows you to integrate any PSR-6 compatible library into your Magento 2.0 project.
As well it is more convenient to use PSR-6 based cache pool than creating your custom cache type for a Magento module.
Installation
-
Add module as dependency:
-
Enable module
- Enable PSR-6 cache type
Usage
Basic usage
If you already have a PSR-6 compatible library, that uses Psr\Cache\CacheItemPoolInterface
in one of its components, it will work out of the box.
All the cache keys will be automatically prefixed with psr6_
prefix in standard Magento cache storage. Also PSR6 cache tag will be applied automatically.
Using custom cache tags and prefix
If you would like to implement own cache invalidation on particular actions (ERP import, etc).
Then you might find it convenient to use additional custom cache tags so items will be cleaned by them on invoking clear()
method.
-
Add a new virtual type into your
di.xml
and use it for your instances - Now you can use it in your custom class
Use cache key generator
Modules comes out of the box with properly configured cache key generator, so if you do not want to take care about your cache key structure, but have PSR6 compatible, you can use it:
This allows you remove all that terrible logic of cache key generation based on your class properties.
Read more about cache key generator
Contribution
Make a pull request based on develop branch