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

ActiveLibrary[Caching](/categories/caching)

lsys/cache
==========

lsys module cache

0.0.1(5y ago)0651Apache-2.0PHPCI failing

Since Jul 3Pushed 5y agoCompare

[ Source](https://github.com/php-lsys/cache)[ Packagist](https://packagist.org/packages/lsys/cache)[ RSS](/packages/lsys-cache/feed)WikiDiscussions master Synced 3d ago

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

缓存层抽象封装
=======

[](#缓存层抽象封装)

[![Build Status](https://camo.githubusercontent.com/aa753140a9251e2dfdf2327c091d3898e4b22c2107f66647e92fd3f681939686/68747470733a2f2f7472617669732d63692e636f6d2f7068702d6c7379732f63616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/php-lsys/cache)[![Coverage Status](https://camo.githubusercontent.com/4a251bbb0acee53451a97f0d0ed8db714a2e7c03bc253f4bc04caf675933f616/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7068702d6c7379732f63616368652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/php-lsys/cache?branch=master)

> 封装此类库是为了让业务逻辑的KEY-VALUE操作脱离具体的某个缓存服务,如:redis或其他,提升代码兼容性

使用示例:

```
//设置缓存使用配置,默认使用文件缓存
//不建议使用文件缓存,目前服务器很多性能都卡在磁盘IO上
\LSYS\Cache\DI::$config="cache.file";

```

```
$cache=\LSYS\Cache\DI::get()->cache();
// 设置缓存
var_dump($cache->set("a1231231df","b"));
// 获取缓存
var_dump($cache->get("a1231231df"));
// 判断缓存是否存在
var_dump($cache->exist("a1231231df"));
// 删除缓存
var_dump($cache->delete("a1231231df"));
// 删除所有缓存,注意:系统消耗大,不建议频繁调用
var_dump($cache->delete_all());

```

默认memcache 及redis 适配下已实现arithmetic及tags接口,可使用使用某key的自增减操作及按TAG操作缓存 关联数据设置缓存的时候会比较常用到,具体示例如下:

```
$cache=\LSYS\Cache\DI::get()->cache();
// 设置缓存,注意:通过tag_set设置数据通过get函数不可获取..
$tag=array('tag1');
var_dump($cache->tag_set("a1231231df","b",$tag));
// 获取缓存
var_dump($cache->tag_get("a1231231df"));
// 通过tag获取缓存
var_dump($cache->tag_find("tag1"));
// 通过tag删除某个缓存
var_dump($cache->tag_delete("tag1"));

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

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

2142d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f1652fec3beae86de90c6615dd28be4729251e1b2bb08f1cd18e8193e6c4e48?d=identicon)[lsys](/maintainers/lsys)

---

Top Contributors

[![shanliu](https://avatars.githubusercontent.com/u/2927231?v=4)](https://github.com/shanliu "shanliu (20 commits)")[![php-lsys](https://avatars.githubusercontent.com/u/43031308?v=4)](https://github.com/php-lsys "php-lsys (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/lsys-cache/health.svg)](https://phpackages.com/packages/lsys-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)
