承接 ftembe/cachehandler 相关项目开发

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

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

ftembe/cachehandler

最新稳定版本:v1

Composer 安装命令:

composer require ftembe/cachehandler

包简介

The project is a lightweight caching solution that improves performance by storing and retrieving data efficiently. It offers a file-based storage approach with customizable expiration times, automatic removal of expired data, and ensures the cache folder is accessible and writable. Integrating this

README 文档

README

The project is a lightweight caching solution that improves performance by storing and retrieving data efficiently. It offers a file-based storage approach with customizable expiration times, automatic removal of expired data, and ensures the cache folder is accessible and writable. Integrating this caching mechanism enhances application speed and reduces processing time.

Installation

composer require ftembe/cachehandler

Or

git clone https://github.com/FTembe/Cachehandler.git

How to use

<?php

use Ftembe\Cachehandler\Cachehandler;

require 'vendor/autoload.php';

function fetchDataFromApi($endPoint =  'https://jsonplaceholder.typicode.com/photos/')
{

   $curl = curl_init();

   curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
   curl_setopt($curl, CURLOPT_URL, $endPoint);
   curl_setopt($curl,  CURLOPT_RETURNTRANSFER, true);

   $response = curl_exec($curl);

   if ($e = curl_error($curl))
       echo $e;

   curl_close($curl);

   return $response;
}

/*
You can create a folder to receive temporary data and pass it as a parameter when instantiating the CacheHandler class
eg. $cacheHandler = new Cachehandler('cacheFolder');
*/

$cacheHandler = new Cachehandler();

if ($cacheHandler->getDataLength('photos') != 5000){
   $store = $cacheHandler->store('photos', json_decode(fetchDataFromApi()), '1 hour');
}

$getDataLength = $cacheHandler->getDataLength('photos');
$getDataType = $cacheHandler->getDataType('photos');

$get = $cacheHandler->get('photos');


var_dump($get);
var_dump($getDataLength);
var_dump($getDataType);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固