定制 mireiawen/cache 二次开发

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

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

mireiawen/cache

Composer 安装命令:

composer require mireiawen/cache

包简介

A wrapper for the PhpFastCache caching backend

README 文档

README

A wrapper for PhpFastCache caching backend, using its PSR-16 implementation. This wrapper supports some of the more common drivers, as well as has the methods to read, write, delete and check for keys in the backend.

  • Class: Cache
  • Namespace: Mireiawen\Cache

Requirements

  • Cache backend
  • PHP7

Installation

You can clone or download the code from the GitHub repository or you can use composer: composer require mireiawen/cache

Methods

__construct

Cache::__construct(string $driver, array $config = [])

Set up the caching backend driver

Arguments

  • string $driver - The cache backend driver to use, currently supported are:
    • files
    • memcache
    • memcached
    • redis
    • predis
  • array $config - The backend specific configuration options
    • files:
      • path - The filesystem path where to store the cached data
    • memcache, memcached:
      • host - The hostname to connect to, defaults to localhost
      • port - The port to connect to, defaults to 11211
    • redis, predis:
      • host - The hostname to connect to, defaults to localhost
      • port - The port to connect to, defaults to 6379
      • password - The password to connect with, defaults to NULL
      • database - The database to use, defaults to NULL

Exceptions thrown

PhpfastcacheDriverCheckException
  • On Driver errors
PhpfastcacheLogicException
  • On PhpFastCache logic errors
\Exception
  • In case of configuration errors

Available

Cache::Available(string $id)

Check if the key exists in the cache backend

Arguments

  • string $id - The cache ID to check for

Return value

  • bool - TRUE if $id is cached, FALSE otherwise

Exceptions thrown

PhpfastcacheSimpleCacheException
  • On cache errors

Invalidate

Cache::Invalidate(string $id)

Invalidate or delete the key from the cache backend

Arguments

  • string $id - The cache ID to invalidate

Exceptions thrown

PhpfastcacheSimpleCacheException
  • On cache errors

Write

Cache::Write(string $id, mixed $value, int $ttl)

Store a value to the cache backend

Arguments

  • string $id - The cache ID to store to
  • mixed $value - The value to store to the cache
  • int $ttl - The time to live for the cached item

Exceptions thrown

PhpfastcacheSimpleCacheException
  • On cache errors

Read

Cache::Read(string $id)

Retrieve a stored value from the cache backend

Arguments

  • string $id - The cache ID to read from

Return value

  • mixed - The stored value of the key

Exceptions thrown

PhpfastcacheSimpleCacheException
  • On cache errors

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固