lfbn/file-get-contents-proxy
Composer 安装命令:
composer require lfbn/file-get-contents-proxy
包简介
A proxy, around file_get_contents, that gives him extra features.
关键字:
README 文档
README
A proxy with extra features around file_get_contents.
Installation
Install the package with composer:
composer require "lfbn/file-get-contents-proxy"
Why use this?
With this package you can use file_get_contents to get the content of a file, and make this content cacheable in memory.
This way, you have an extra nice feature provided by this proxy, around file_get_contents.
Usage
Obtaining a file content once
If you only need to obtain the file content once, then you don't need to do anything differently. Just use file_get_contents as normal!
<?php $content = file_get_contents('some-file-name.txt');
Obtaining a file content several times
If you want to tke advantage of this package, and need to obtain a file content several times, then you can use memory cache.
<?php use FileGetContentsProxy\FileGetContentsProxy; $fileProxy = new FileGetContentsProxy('some-file-name.txt'); // It will be obtained from the file, and then, saved in memory. $content = $fileProxy->memoryCacheGet(); // It will be obtained from the memory cache. $cachedContent = $fileProxy->memoryCacheGet();
and in between you can request directly, without cache:
<?php $newContent = $fileProxy->directGet();
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-22