PHPackages                             yilu-tech/sharecache - 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. yilu-tech/sharecache

ActiveLibrary[Caching](/categories/caching)

yilu-tech/sharecache
====================

Laravel ShareCache.

2.0.15(5y ago)0295MITPHP

Since Jul 9Pushed 4y ago2 watchersCompare

[ Source](https://github.com/yilu-tech/laravel-sharecache)[ Packagist](https://packagist.org/packages/yilu-tech/sharecache)[ RSS](/packages/yilu-tech-sharecache/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (38)Used By (0)

### 安装

[](#安装)

```
    # 添加源
    {
        "type": "git",
        "url": "https://gitlab.yilu.co/yilu/laravel-sharecache.git"
    }

    composer require yilu-dev/sharecache
```

### 配置信息

[](#配置信息)

1.生成配置文件

`php artisan vendor:publish --tag=sharecache-config`

2.配置信息

```
   [
        'name' => 'server_name', // 服务名称

        'url' => env('APP_URL'), // 服务地址

        'cache' => [
            'prefix' => 'sharecache',
            'ttl' => 1209600
        ],

        'route_option' => [

        ],

        // 默认获取 $model->toJson() 作为缓存对象， 自定义请定义 getShareCacheData()
        'models' => [       // 'alias' => 'class'

        ],

        // 注册模型做为监听模型， 必须定义 getShareCacheData()
        'repositories' => [

        ]
   ]
```

3.注册文件

`php artisan sharecache:register`

4.查看注册信息

`php artisan sharecache:show`

5.清除缓存

```
php artisan sharecache:flush

--server=*  // 服务名字, 为空清除所有服务下的对象

--object=*  // 缓存对象, 为空清除服务下的所有对象

--except    // 对前面条件取反

```

### 使用

[](#使用)

```
ShareCache::service($name = null)->get($object, $key) // $name=服务名称,默认取当前服务； $object=缓存对象名称； $key=缓存对象key

ShareCache::{$server}()->get($object, $key) // $server=服务名称
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

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

Recently: every ~63 days

Total

36

Last Release

1763d ago

Major Versions

1.2.2 → 2.0.02020-10-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb3c0cf7cb789f83b86b4a450ba1766d6d6b81c51465c5654a62ab9ffb3f98ff?d=identicon)[yilu-tech](/maintainers/yilu-tech)

---

Top Contributors

[![gatherchou](https://avatars.githubusercontent.com/u/8440791?v=4)](https://github.com/gatherchou "gatherchou (2 commits)")

---

Tags

laravelShareCache

### Embed Badge

![Health badge](/badges/yilu-tech-sharecache/health.svg)

```
[![Health](https://phpackages.com/badges/yilu-tech-sharecache/health.svg)](https://phpackages.com/packages/yilu-tech-sharecache)
```

###  Alternatives

[encore/redis-manager

Redis manager for laravel

25243.1k](/packages/encore-redis-manager)[ginnerpeace/laravel-redis-lock

Simple redis distributed locks for Laravel.

15114.4k](/packages/ginnerpeace-laravel-redis-lock)

PHPackages © 2026

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