PHPackages                             w7/laravel-cache-model - 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. w7/laravel-cache-model

Abandoned → [w7/rangine-cache-model](/?search=w7%2Frangine-cache-model)Library[Caching](/categories/caching)

w7/laravel-cache-model
======================

对Laravel框架的Model扩展缓存支持

v1.0.1(6y ago)0641Apache-2.0PHPPHP 7.\*CI failing

Since Mar 7Pushed 4y ago2 watchersCompare

[ Source](https://github.com/we7coreteam/w7-laravel-cache-model)[ Packagist](https://packagist.org/packages/w7/laravel-cache-model)[ RSS](/packages/w7-laravel-cache-model/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (9)Dependencies (6)Versions (6)Used By (0)

w7Laravel
=========

[](#w7laravel)

#### 使用说明

[](#使用说明)

### 1. 注册 `Psr\SimpleCache\CacheInterface` 实现

[](#1-注册-psrsimplecachecacheinterface-实现)

```
\W7\Laravel\CacheModel\Caches\Cache::setCacheResolver(Cache::store());

```

### 2. 继承 `W7\Laravel\CacheModel\Model`

[](#2-继承-w7laravelcachemodelmodel)

```
use W7\Laravel\CacheModel\Model;

class Member extends Model
{
	public $timestamps = false;

	protected $table = 'members';

	protected $primaryKey = 'uid';

    // 此行可缺省
	protected $useCache = true;
}

```

### 3. 使用

[](#3-使用)

#### find($id)

[](#findid)

```
$uid  = 1;
$user = Member::query()->find($uid);
$user = Member::query()->find($uid);

// query once
// select * from `ims_members` where `ims_members`.`uid` = ? limit 1

```

#### find($ids)

[](#findids)

仅限指定 id 查询，不限定返回列。

```
$uids = [1, 2, 5];
Member::query()->find($uids);
Member::query()->find($uids);

// query once
// select * from `ims_members` where `ims_members`.`uid` in (?, ?, ?)

```

#### $model-&gt;save();

[](#model-save)

删除缓存。

```
$member = Member::find($uid)
$member->invite_code = rand(1, 100000);
$member->save();

```

#### $model-&gt;update();

[](#model-update)

删除缓存

#### $model-&gt;delete();

[](#model-delete)

删除缓存

#### Member::flush();

[](#memberflush)

清空指定表的缓存

#### Cache::flush();

[](#cacheflush)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 56.1% 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 ~44 days

Total

3

Last Release

2499d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67366373461d229a38d9b2f4b9f5fe6bd87a1c9bb74fedcf45d089f3ec90268d?d=identicon)[donknap@gmail.com](/maintainers/donknap@gmail.com)

---

Top Contributors

[![titrxw](https://avatars.githubusercontent.com/u/19631469?v=4)](https://github.com/titrxw "titrxw (32 commits)")[![gordensong](https://avatars.githubusercontent.com/u/7833600?v=4)](https://github.com/gordensong "gordensong (19 commits)")[![fykyx521](https://avatars.githubusercontent.com/u/3068711?v=4)](https://github.com/fykyx521 "fykyx521 (4 commits)")[![donknap](https://avatars.githubusercontent.com/u/4213382?v=4)](https://github.com/donknap "donknap (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/w7-laravel-cache-model/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M123](/packages/laravel-pulse)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k55.1k1](/packages/mike-bronner-laravel-model-caching)[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.

2119.7k](/packages/iazaran-smart-cache)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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