定制 lunkkun/caching-generator 二次开发

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

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

lunkkun/caching-generator

最新稳定版本:v3.1.0

Composer 安装命令:

composer require lunkkun/caching-generator

包简介

A rewindable PHP Generator class that caches its generated values.

README 文档

README

Introduction

A PHP Iterator class that you can wrap around a generator to cache its generated values. When iterating over this class for a second time, values will be pulled from the cache.

If stopped halfway through generating, when iterating for a second time, it will continue generating (and caching) values after exhausting the cache.

Installation

Require this package with composer using the following command:

composer require lunkkun/caching-generator

Usage

<?php

use Lunkkun\CachingGenerator\CachingGenerator;

$generator = function () {
    foreach (range(0, 2) as $value) {
        yield $value;
    }
};
$cachingGenerator = new CachingGenerator($generator());

foreach ($cachingGenerator as $value) {
    echo $value;
}

foreach ($cachingGenerator as $value) {
    echo $value;
}

Outputs:

012012

License

PHP Caching Generator is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固