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

ActiveLibrary[Caching](/categories/caching)

edv/cache
=========

redis cache (read/write through)

v3.1.4(6mo ago)2214PHP

Since Feb 26Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/edwin-HF/cache)[ Packagist](https://packagist.org/packages/edv/cache)[ RSS](/packages/edv-cache/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (9)Dependencies (1)Versions (16)Used By (0)

redis cache strategy(read through)
==================================

[](#redis-cache-strategyread-through)

### 简介

[](#简介)

```
该项目是基于read through 缓存策略实现的相关接口，基于redis
你要做的是提供缓存策略的Provider层，当前项目已经封装了一些常用的
数据结构（基于redis的数据结构实现）
在你的Provider层实现相应的接口
即可有效的管理你的缓存系统

```

### 安装

[](#安装)

```
composer require edv/cache

```

### 支持数据结构

[](#支持数据结构)

- CacheMap（redis 原 hashes 结构）
- CacheList（redis 原 zset 结构）
- CacheString（redis 原 string 结构）
- CacheBitmap(redis 原 bitmap 结构)

### 推荐目录结构

[](#推荐目录结构)

```
    cache
        |--provider1
            |--class UserList extend AbstractProvider1
            ...
        |--provider2
            |--class Bitmap1 extend AbstractProvider2
            ...
        |--abstract class AbstractProvider1 extend CacheList...(实现统一配置)
        |--abstract class AbstractProvider2 extend CacheBitmap...(实现统一配置)
        ...

```

### 需要实现的方法

[](#需要实现的方法)

```
redis 链接配置 config():array

return [
    'host' => '',
    'port' => '',
    'password' => '',
    'database' => '',
];

config 建议在provider抽象类中实现，将统一的redis链接抽象成基类

数据填充（list/map） patch():array

list
    return [1,2,3];

map
    return ['key'=>'val1','key2'=>'val2'];

patch 在子类中实现，如果不需要初始化缓存数据，可 use EmptyPatch trait

```

### 缓存过期策略

[](#缓存过期策略)

```
1 可以通过过期时间，子类实现expire方法，expire 可以返回具体的过期时间（eg:"2022-02-12 09:12:00"） 也可以返回时长（单位是秒）

2 调用flush主动删除缓存

```

```
该项目开箱即用，如果还有疑问可参考test.php中的相关案例。

 嗯...

```

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance68

Regular maintenance activity

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~150 days

Recently: every ~173 days

Total

13

Last Release

185d ago

Major Versions

1.6 → v2.0.12022-02-18

v2.0.6 → v3.0.02022-03-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/57161170eced9301948894050032cc359efe3abf158f295530a2295c5ef070f2?d=identicon)[Edwin Fan](/maintainers/Edwin%20Fan)

---

Top Contributors

[![edwin-HF](https://avatars.githubusercontent.com/u/18612575?v=4)](https://github.com/edwin-HF "edwin-HF (9 commits)")

---

Tags

cachephpredis

### Embed Badge

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

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

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

28.0k175.2k9](/packages/bagisto-bagisto)[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[rhubarbgroup/redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.

529103.2k1](/packages/rhubarbgroup-redis-cache)[millipress/millicache

WordPress Full-Page Cache based on Rules &amp; Flags. Delivers flexible, scalable caching workflows backed by Redis and ValKey in-memory stores.

734.4k3](/packages/millipress-millicache)[symfony-bundles/redis-bundle

Symfony Redis Bundle

271.2M7](/packages/symfony-bundles-redis-bundle)[lion/bundle

Lion-framework configuration and initialization package

122.4k5](/packages/lion-bundle)

PHPackages © 2026

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