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(10y ago)21001Apache-2.0PHPPHP &gt;=5.5.9

Since Jun 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/slince-archived/cache)[ Packagist](https://packagist.org/packages/slince/cache)[ RSS](/packages/slince-cache/feed)WikiDiscussions master Synced 1w 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 46% 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

3702d 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

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