dercoder/simple-cache-shared-memory 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dercoder/simple-cache-shared-memory

最新稳定版本:1.0.0

Composer 安装命令:

composer require dercoder/simple-cache-shared-memory

包简介

README 文档

README

A simple cache implementation using shared memory in PHP.

Installation

You can install the package using Composer:

composer require dercoder/simple-cache-shared-memory

Usage

use DerCoder\SimpleCache\SharedMemory\SharedMemoryCache;
use Psr\SimpleCache\CacheInterface;

$cache = new SharedMemoryCache('1M'); // 1MB shared memory segment

// Set cache items
$cache->set('key1', 'value1');
$cache->set('key2', [1, 2, 3], 60); // with TTL of 60 seconds

// Get cache items
$value1 = $cache->get('key1');
$value2 = $cache->get('key2');

// Check if a cache item exists
$hasKey1 = $cache->has('key1');

// Delete cache items
$cache->delete('key1');

TODO

  • Lock functions so multiple threads will not overwrite values
  • Second release for PHP 8+

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-19