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

ActiveLibrary[Caching](/categories/caching)

vemcogroup/model-cache
======================

Static cache instead of re-hitting cache server

1.0.1(5y ago)130.6k↑40.9%MITPHPPHP &gt;=7.1

Since Apr 5Pushed 5y ago2 watchersCompare

[ Source](https://github.com/vemcogroup/model-cache)[ Packagist](https://packagist.org/packages/vemcogroup/model-cache)[ Docs](https://github.com/vemcogroup/model-cache)[ RSS](/packages/vemcogroup-model-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Model local cache
=================

[](#model-local-cache)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5948fab989d571669c2db08020ab0c9d3e8b4c62a9771b1dc13ed0f069adbaf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76656d636f67726f75702f6d6f64656c2d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vemcogroup/nova-websockets)[![Total Downloads](https://camo.githubusercontent.com/1037593fd6b5d7bab66c48df4f427afaee0968efa47c13bf2040a21c85cd5537/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76656d636f67726f75702f6d6f64656c2d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vemcogroup/nova-websockets)

Description
-----------

[](#description)

This package allows to have static local cache on your models.

It can both be used with a cache server or without.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require vemcogroup/model-cache
```

Usage
-----

[](#usage)

It's easy to use the trait in your own class just Use the trait as below

```
use Vemcogroup\ModelCache\Traits\HaslocalCache;

class DataRepository
{
    use HasLocalCache;

    public function getData($userId)
    {
        $localCacheKey = 'getData.'.$userId;

        /*
         * If localCache exists with key return cache
         */
        if ($cache = self::getLocalCache($localCacheKey)) {
           return $cache;
        }

         // Run DB query or Cache code
         $result = [1, 2, 3, 4, 5, 6];

         /*
          * Remember to save your DB query or Cache result
          */
         self::setLocalCache($localCacheKey, $result);

         return $result;
    }
}
```

If you need to clear the Cache you can use the clear method

```
self::clearLocalCache();
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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

Every ~606 days

Total

2

Last Release

1994d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38252305?v=4)[Vemco Group A/S](/maintainers/vemcogroup)[@vemcogroup](https://github.com/vemcogroup)

---

Top Contributors

[![danijelk](https://avatars.githubusercontent.com/u/580753?v=4)](https://github.com/danijelk "danijelk (1 commits)")

---

Tags

laravelmodelrediscache

### Embed Badge

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

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

###  Alternatives

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[vink/nova-cache-card

Manage your application's cache from a handy Laravel Nova dashboard card.

26317.3k1](/packages/vink-nova-cache-card)[byerikas/cache-tags

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

1413.9k](/packages/byerikas-cache-tags)

PHPackages © 2026

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