定制 marco476/filesystem-cache 二次开发

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

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

marco476/filesystem-cache

Composer 安装命令:

composer require marco476/filesystem-cache

包简介

PHP Filesystem cache builded with PSR-6 rules

README 文档

README

Build Status Packagist Code Climate Issue Count PHP Version Packagist

PHP Filesystem cache

Filesystem cache is a quick, simple and secure filesystem cache service builded with PSR-6 rules.

Installation

You can install it with Composer:

composer require marco476/filesystem-cache

How to use it

Filesystem cache implement perfectly the PSR-6 directive. So, you can use it very easily: See an example:

<?php
require_once __DIR__ . '/../vendor/autoload.php';

use \Service\Cache\CacheDir;
use \Service\Cache\CacheItemPool;

CacheDir::setCacheDir($_SERVER["DOCUMENT_ROOT"] . '/../cache');
$itemPool = new CacheItemPool();
$itemCache = $itemPool->getItem('myArray');

if ($itemCache->isHit()) {
    echo 'Hit, hit! <br>';
    print_r( $itemCache->get() );
} else {
    $value = array(
        'name'      => 'Marco',
        'friends'   => array('Paolo','Luca')
    );

    $itemCache->set($value);
    $itemPool->save($itemCache);

    echo 'All saved! <br>';
    print_r( $value );
}

The setCacheDir static's CacheDir method accept the cache path. If you can't pass it, the default cache path will be:

$_SERVER["DOCUMENT_ROOT"] . '/cache/'

For detail, you can see PSR-6 documentation

Remember that you must create the cache directory with permission to write and read!

Unit Test

You can run unit test from document root with:

vendor/bin/phpunit

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固