PHPackages                             king192/phpcache - 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. king192/phpcache

ActiveLibrary[Caching](/categories/caching)

king192/phpcache
================

php cache from thinkphp5

v1.0.x-dev(8y ago)015apache2.0PHP

Since Aug 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/king192/phpcache)[ Packagist](https://packagist.org/packages/king192/phpcache)[ RSS](/packages/king192-phpcache/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (3)Used By (0)

/\*\*

- 缓存管理
- @param mixed $name 缓存名称，如果为数组表示进行缓存设置
- @param mixed $value 缓存值
- @param mixed $options 缓存参数
- @param string $tag 缓存标签
- @return mixed \*/ function cache($name, $value = '', $options = null, $tag = null) { define('CACHE\_PATH', S\_ROOT . 'cache');

    require S\_ROOT . 'vendor/autoload.php'; if (is\_array($options)) { // 缓存操作的同时初始化 \\king192\\phpcache\\Cache::connect($options); } elseif (is\_array($name)) { // 缓存初始化 return \\king192\\phpcache\\Cache::connect($name); } if (is\_null($name)) { return \\king192\\phpcache\\Cache::clear($value); } elseif ('' === $value) { // 获取缓存 return 0 === strpos($name, '?') ? \\king192\\phpcache\\Cache::has(substr($name, 1)) : \\king192\\phpcache\\Cache::get($name); } elseif (is\_null($value)) { // 删除缓存 return \\king192\\phpcache\\Cache::rm($name); } elseif (0 === strpos($name, '?') &amp;&amp; '' !== $value) { $expire = is\_numeric($options) ? $options : null; return \\king192\\phpcache\\Cache::remember(substr($name, 1), $value, $expire); } else { // 缓存数据 if (is\_array($options)) { $expire = isset($options\['expire'\]) ? $options\['expire'\] : null; //修复查询缓存无法设置过期时间 } else { $expire = is\_numeric($options) ? $options : null; //默认快捷缓存设置过期时间 } if (is\_null($tag)) { return \\king192\\phpcache\\Cache::set($name, $value, $expire); } else { return \\king192\\phpcache\\Cache::tag($tag)-&gt;set($name, $value, $expire); } } }

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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

3282d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae2ca3288cda0302f57e55938811963759fa270e07dab3b9c421a3d3943aba38?d=identicon)[king192](/maintainers/king192)

---

Top Contributors

[![xhq192](https://avatars.githubusercontent.com/u/34006284?v=4)](https://github.com/xhq192 "xhq192 (6 commits)")[![forevervas](https://avatars.githubusercontent.com/u/7793865?v=4)](https://github.com/forevervas "forevervas (1 commits)")

### Embed Badge

![Health badge](/badges/king192-phpcache/health.svg)

```
[![Health](https://phpackages.com/badges/king192-phpcache/health.svg)](https://phpackages.com/packages/king192-phpcache)
```

###  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)

PHPackages © 2026

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