承接 takuya/php-sysv-ipc-shm-cache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

takuya/php-sysv-ipc-shm-cache

最新稳定版本:0.2

Composer 安装命令:

composer require takuya/php-sysv-ipc-shm-cache

包简介

php sysv ipc cache

README 文档

README

This package is for caching data into SysV SharedMemory.

Installing

from Packagist

composer require takuya/php-sysv-ipc-shm-cache

from GitHub

name='php-sysv-ipc-shm-cache'
composer config repositories.$name \
vcs https://github.com/takuya/$name  
composer require takuya/$name:master
composer install

Examples

<?php
$cache = new SysvShmCache('cache_name');
$cache->set($key, $data);
$cache->has($key);
$cache->get($key);
$cache->delete($key);

Safer Update Value for Multi Process.

Update read/write at once which called by get() then set(), use locking.

<?php
$cache = new SysvShmCache($cache_name);
$key = 'key';
$cache->runWithLock(function($cache)use($key,$idx){
  $cache->set($key, $cache->get($key) + 10 );
});

// without locking, this can be dirty read.
$cache->set($key, $cache->get($key) + 10 );

'psr/simple-cache' are used.

This package is implementation of psr/simple-cache into Shared Memory (shm_xxx).

remove ipc by manually

If unused ipc remains. use SHELL command to remove.

ipcs -m | grep $USER | grep -oE '0x[a-f0-9]+' | xargs -I@ ipcrm --shmem-key @
ipcs -s | grep $USER | grep -oE '0x[a-f0-9]+' | xargs -I@ ipcrm --semaphore-key @

统计信息

  • 总下载量: 937
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-03-06