bookking3000/guzzcache 问题修复 & 功能扩展

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

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

bookking3000/guzzcache

Composer 安装命令:

composer require bookking3000/guzzcache

包简介

A in-File JSON-Cache for storing Guzzle HTTP Responses from REST-APIs

README 文档

README

A in-File JSON-Cache for storing Guzzle HTTP Responses from REST-APIs

Installation

Install using composer:

    composer require bookking3000/guzzcache

Autoloading

Please include the following to autoload Classes

    require_once __DIR__.'/vendor/bookking3000/guzzcache/autoload.php';

Usage

    //Initialize Json-File for Caching.
    $jsonCache = new JsonCache();
    $jsonCache->setCachePath($this->cachePath);

    //Initialize GuzzCache and set the Cache to the Cache initialized before.
    $guzzCache = new GuzzCache();
    $guzzCache->setCache($jsonCache);

    //If your request was already sent, this method will retrieve it from the local in-File Cache
    $content = $guzzCache->httpQuery("https://jsonplaceholder.typicode.com/todos/1", "GET");

Lifetime

Default Lifetime is 30 days / 2592000 Seconds.

You can change it as follows:

    $jsonCache = new JsonCache();
    $jsonCache->setCachePath($this->cachePath);
    $jsonCache->setLifetime(60); //60 Seconds

To disable Lifetime, set Lifetime to 0.

    $jsonCache = new JsonCache();
    $jsonCache->setCachePath($this->cachePath);
    $jsonCache->setLifetime(0);

Debug

Setting Debug to true, will log all Requests. By Default only Requests with non 2xx Response Status-Codes are logged.

The Log is stored in the logs-Folder in the Library-Directory itself.

    $guzzCache = new GuzzCache();
    $guzzCache->setDebug(true);

Changelog

2022-02-15

  • Added Expiry-Time to Cache

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固