承接 truesocialmetrics/cache-storage-adapter-large-items 相关项目开发

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

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

truesocialmetrics/cache-storage-adapter-large-items

最新稳定版本:2.1.1

Composer 安装命令:

composer require truesocialmetrics/cache-storage-adapter-large-items

包简介

Laminas cache adapter for large items

README 文档

README

A Laminas Cache Storage adapter that enables storing large items by automatically splitting them into smaller chunks.

Installation

Install via composer:

composer require truesocialmetrics/cache-storage-adapter-large-items

Features

  • Transparently handles large cache items by splitting them into smaller chunks
  • Compatible with any existing Laminas Cache Storage adapter
  • Configurable maximum item size
  • Preserves complex data structures through JSON serialization
  • Automatic cleanup of chunked items on removal

Usage

$cache = new \Laminas\Cache\Storage\Adapter\Memory();
$packer = new \Twee\Cache\Storage\Adapter\Packer($cache, 1000);

$packer->setItem('large_item', ['data' => str_repeat('a', 100000)]);
$item = $packer->getItem('large_item');
var_dump($item);

How It Works

The adapter automatically handles large items by:

  1. Attempting to store items directly if they're under the maximum size limit
  2. For larger items:
    • Splits the data into smaller chunks
    • Stores each chunk with a unique key
    • Creates an index to track all chunks
    • Automatically reassembles the data when retrieving
    • Cleans up all chunks when removing items

Configuration

Option Type Default Description
maxItemSize int 300000 Maximum size in bytes for a single cache item

Requirements

  • PHP 8.0 or later
  • laminas/laminas-cache

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-12