定制 inkime/phpspreadsheetcache 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

inkime/phpspreadsheetcache

Composer 安装命令:

composer require inkime/phpspreadsheetcache

包简介

a cache component of PhpSpreadsheet

关键字:

README 文档

README

a cache component of PhpSpreadsheet

PhpSpreadsheet 在工作表中平均每个单元格使用约 1k,因此大型工作簿可以迅速用尽可用内存。

单元缓存提供了一种机制,该机制允许 PhpSpreadsheet 在较小的内存或非内存(例如,在磁盘上,APCu,内存缓存或 Redis、Memcache 中)中维护单元对象。

这使您可以减少大型工作簿的内存使用量,尽管以访问单元数据的速度为代价。

自定义缓存必须先引入 psr/simple-cache:^1.0 包并实现 Psr\SimpleCache\CacheInterface 接口

获取更多信息,请参考PhpSpreadsheet官方文档

PhpSpreadsheetCache 提供了自定义缓存组件的实现

Composer安装:

composer require inkime/phpspreadsheetcache

使用示例:

$reader = IOFactory::createReader('Csv');
$reader->setReadDataOnly(true);
$config = [
    'type' => 'Redis', // 或者File
    'host' => '127.0.0.1',
    'port' => 6379,
    'password' => '123456',
    'select' => '1',
    'path' => Yii::getAlias('@runtime/spreadsheet'), // 文件缓存路径
];
Settings::setCache(Cache::init($config));
foreach ($arr as $val) {
    $spreadSheet = $reader->load(Yii::getAlias('@runtime/a.csv'));
    $workSheet = $spreadSheet->getActiveSheet();
    // 释放内存
    $workSheet->disconnectCells();
    // 清理缓存
    // Cache::clear();
    // your code
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固