Download the PHP package flyokai/magento-amp-mate without Composer
On this page you can find all versions of the php package flyokai/magento-amp-mate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flyokai/magento-amp-mate
More information about flyokai/magento-amp-mate
Files in flyokai/magento-amp-mate
Package magento-amp-mate
Short Description Magento specific AMPHP helpers
License MIT
Informations about the package magento-amp-mate
flyokai/magento-amp-mate
User docs →
AGENTS.mdAsync Magento cache backend powered by AMPHP — file-based caching that doesn't block the event loop.
A drop-in replacement for Cm_Cache_Backend_File that performs file I/O via amphp/file, protecting reads/writes with ampFlock() from flyokai/amp-mate.
Features
Rewrite\CmCacheBackendFile— async file cache backend, 100% protocol-compatible with the Magento cache front-endsMageCache\Data\AmpStreamReader— async stream parser for the metadata + data layout used by Magento cache files- Optional
flockviaampFlock()for safe concurrent access
Installation
CmCacheBackendFile
Rewrite\CmCacheBackendFile extends Magento's Cm_Cache_Backend_File and replaces blocking file I/O with AMPHP equivalents:
_getCache()— async read viaAmpStreamReadersave()— async write with optionalflock_clean()— async recursive cleanup_filePutContents()— usesAmp\File\openFile()with optional locking_fileGetContents()— buffered read viaampStreamBuffer()
Wire it into Magento's cache configuration as you would any other cache backend implementation.
AmpStreamReader
Layout: first line is serialised metadata, the rest is the cache data. The reader uses AMPHP's Parser class to keep state, so parsing is incremental.
Gotchas
- Mixed sync/async in
_clean()— usesis_dir()/rmdir()(sync) alongside async operations. AmpStreamReaderconsumes parser state — callinggetMeta()beforegetData()advances the cursor; ordering matters.- Random tag-file compaction — there's a 1% chance of rewriting tag files during merge.
_getTagIds()accepts multiple types — string path, AmpFile, or resource. Caller must be unambiguous.- File locking is optional — controlled by
$this->_options['file_locking']. Race conditions if disabled.
See also
flyokai/amp-mate—ampFlock,ampOpenFile, and friendsflyokai/magento-dto— Magento DTOs
License
MIT
All versions of magento-amp-mate with dependencies
amphp/file Version ^3
amphp/byte-stream Version ^2
amphp/parser Version ^1
flyokai/amp-mate Version self.version