PHPackages                             james-xiao/think-cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. james-xiao/think-cache

ActiveLibrary[Caching](/categories/caching)

james-xiao/think-cache
======================

tp5.0 cache

v0.0.2(5y ago)021MITPHPPHP &gt;=5.4

Since Sep 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/gitzhaoxiaoli/think-cache)[ Packagist](https://packagist.org/packages/james-xiao/think-cache)[ RSS](/packages/james-xiao-think-cache/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

PHP CACHE 从ThinkPHP 5.0 中提取出来
=============================

[](#php-cache-从thinkphp-50-中提取出来)

> require: php&gt;=5.4

安装
--

[](#安装)

使用composer安装

```
composer require james-xiao/think-cache

```

用法

```
require_once __DIR__ . "/vendor/autoload.php";

$option = [
    // 驱动方式 可选 File , Redis , Memcache 等
    'type'   => 'File',
    // 缓存保存目录 type 为File时，缓存所在路径
    'path'   => './cache/',
    // 缓存前缀
    'prefix' => '',
    // 缓存有效期 0表示永久缓存
    'expire' => 0,
];

$cache = \xiao\Cache::connect($option);
//
// $cache->set('aaa', [[1, 2, 3], ['a' => 3333]]);
var_dump($cache->get('aaa'));

```

然后就可以在命令行

```
// php 要加入到环境变量中
php test.php

```

输出

```
array(2) {
  [0]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
  [1]=>
  array(1) {
    ["a"]=>
    int(3333)
  }
}

```

更多
--

[](#更多)

- [参考手册](https://www.kancloud.cn/manual/thinkphp5/118131)

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2152d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2360f994fb55dd14bd38c0e5052295424bcf7b71a010329c974002c6b19afc57?d=identicon)[406155794](/maintainers/406155794)

---

Top Contributors

[![gitzhaoxiaoli](https://avatars.githubusercontent.com/u/19523098?v=4)](https://github.com/gitzhaoxiaoli "gitzhaoxiaoli (1 commits)")

### Embed Badge

![Health badge](/badges/james-xiao-think-cache/health.svg)

```
[![Health](https://phpackages.com/badges/james-xiao-think-cache/health.svg)](https://phpackages.com/packages/james-xiao-think-cache)
```

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
