承接 mapsight/pulp-cache 相关项目开发

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

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

mapsight/pulp-cache

Composer 安装命令:

composer require mapsight/pulp-cache

包简介

Cache handlers and sources for Pulp pipelines.

README 文档

README

Generic caching helpers for Pulp pipelines.

Features

  • Remember expensive sources: Wrap any source pipeline and reuse cached output on fresh cache hits.
  • Pass-through caching: Cache any file that flows through a pipeline, independent of where it came from.
  • Stale fallback: Keep jobs working with the last cached result if an upstream source fails.
  • Multiple file support: Cache and restore one or more Pulp File objects via a manifest.
  • Raw or serialized payloads: String payloads are stored as raw files; decoded arrays/objects are serialized.

Installation

composer require mapsight/pulp-cache

Remember a Source Pipeline

Use remember() when you want cache hits to skip an expensive upstream operation, such as a large HTTP download.

use OpenMapsight\Pulp;
use OpenMapsight\PulpCache;

$source = Pulp::start()
    ->pipe(Pulp::srcHttp(
        'GET',
        'https://example.com/data.zip',
        ['timeout' => 120],
        'data.zip'
    ));

$files = Pulp::start()
    ->pipe(PulpCache::remember($source, __DIR__ . '/cache', [
        'key' => 'example-data',
        'ttl' => 86400,
        'fallbackToStale' => true,
    ]))
    ->run();

On a fresh cache hit, the wrapped $source pipeline is not executed.

Cache Within a Pipeline

Use cache() as a regular pass-through handler when the upstream pipeline should still be part of the flow.

Pulp::start()
    ->pipe(Pulp::src('*.geojson', __DIR__ . '/input'))
    ->pipe(PulpCache::cache(__DIR__ . '/cache', [
        'ttl' => 3600,
    ]))
    ->pipe(Pulp::dest(__DIR__ . '/result'))
    ->run();

Options

  • key (string): Stable cache key. Defaults to remember for remember() and the current file name for cache().
  • ttl (int): Cache lifetime in seconds. Defaults to 86400.
  • ttl < 0: Cache never expires.
  • ttl = 0: Always refresh/write the cache.
  • fallbackToStale (bool): For remember(), return stale cached files if the wrapped source fails. Defaults to true.

Cache Layout

Each cache key gets its own directory:

cache/
  example-data/
    manifest.json
    0000.zip
    0001.json

manifest.json stores the original Pulp file names, payload encoding, and cache file paths.

Notes

  • Keep cache keys stable and independent of secrets.
  • Do not use a public web directory as the cache directory if cached input contains private URLs, credentials, or paid data.
  • remember() is best for source/subpipeline caching. cache() is best for caching an intermediate file in an already-running pipeline.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固