承接 mehr-it/php-cache 相关项目开发

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

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

mehr-it/php-cache

Composer 安装命令:

composer require mehr-it/php-cache

包简介

PSR-16 simple cache implementation using PHP files as backend

README 文档

README

Caching library using PHP files as backend implementing PSR-16.

Introduction

Thanks to opcache, using PHP files as cache backend improves performance as it benefits from PHPs bytecode cache.

This library is aware of opcache and also invalidates opcache whenever a file is changed.

ATTENTION: Since opcache is not shared between different PHP SAPIs, cache data and locks are independent for each SAPI. Even clearing the cache will only invalidate the cache for the current SAPI.

This library uses flock() for locking.

Installation

Use composer:

composer require mehr-it/php-cache

Usage

The constructor of PhpCache has the following arguments:

new PhpCache(

    // The directory to store all cache data and locks
    // in. Will be created if not existing.
    $baseDir,

    // Ensures that all created files have the given
    // permission, eg. 0660 (optional)
    $filePermission,

    // Ensures that all created directories have the 
    // given permission, eg. 0770 (optional)
    $directoryPermission,

    // If set to false, keys are not checked to special 
    // chars according to PSR-16. This improves 
    // performance.
    $strictKeyValidation
)

Locks

In addition to the PSR-16 interface, the cache implements the ability to create named locks:

$cache = new PhpCache('/tmp/cache');

// create a lock
$lock = $cache->lock('my_lock', LOCK_SH);

// change locking mode, if needed
$lock->setMode(LOCK_EX);

// release lock
$lock->release();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固