gpslab/shmop

Shmop 是一个使用 PHP 操作共享内存的简单且小巧的抽象层

v1.0.0 2017-05-12 14:34 UTC

This package is auto-updated.

Last update: 2024-09-13 18:18:20 UTC


README

Latest Stable Version Total Downloads Build Status Coverage Status Scrutinizer Code Quality SensioLabs Insight StyleCI License

Shmop

Shmop 是一个使用 PHP 操作共享内存的简单且小巧的抽象层。

Shared memory

安装

使用 Composer(https://packagist.org.cn)非常简单,只需运行

composer require gpslab/shmop

使用方法

创建新块

use GpsLab\Component\Shmop\Block;

$sh = new Block(
    0xFF, // id for memory block
    3 // memory block size
);
$sh->write('foo');
echo $sh->read(); // print 'foo'
$sh->delete();

内存块必须是固定大小,才能正确读取。

读取现有块

use GpsLab\Component\Shmop\Block;

$sh = new Block(0xFF, 3);
// print contents of memory block. if block is not exists prints a blank line
echo $sh->read();

许可证

此捆绑包遵循MIT 许可证。完整的许可证文件在 LICENSE 中。