PHPackages                             slince/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. slince/cache

ActiveLibrary[Caching](/categories/caching)

slince/cache
============

Slince Cache Component

1.0.0(9y ago)21001Apache-2.0PHPPHP &gt;=5.5.9

Since Jun 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/slince-archived/cache)[ Packagist](https://packagist.org/packages/slince/cache)[ RSS](/packages/slince-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Cache Component
===============

[](#cache-component)

缓存机制是很常见的在现在的web应用中，改组件致力于用简单完善的逻辑实现缓存在项目中的应用。目前支持的缓存形式有file，apc，memcache,array(临时缓存，只对当前请求有效)

安装
--

[](#安装)

在composer.json中添加

```
{
    "require": {
        "slince/cache": "*"
    }
}

```

用法
--

[](#用法)

```
$fileCache = new Slince\Cache\FileCache('./tmp/');

//设置默认有效时间为两小时，默认是一小时
$fileCache->setDuration(7200);

//设置记录
$fileCache->set('key1', 'val1');

//添加记录
$fileCache->set('key2', 'val2');

//删除记录
$fileCache->delete('key1');

//判断是否存在
$fileCache->exists('key1');

//清除所有
$fileCache->flush();

```

你也可以在添加记录时单独设置缓存时间，只要add和set方法提供第三个参数即可，但不会影响全局的默认时间；所有的缓存时间单位都是秒数。

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3610d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3785826?v=4)[Tao](/maintainers/slince)[@slince](https://github.com/slince)

---

Top Contributors

[![slince](https://avatars.githubusercontent.com/u/3785826?v=4)](https://github.com/slince "slince (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slince-cache/health.svg)

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

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

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