PHPackages                             masterzydra/magento2-ucache - 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. masterzydra/magento2-ucache

ActiveMagento2-module[Caching](/categories/caching)

masterzydra/magento2-ucache
===========================

Module that adds an universal cache to Magento2

1.4.0(1y ago)12011MITPHPPHP ^8.2

Since Mar 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MasterZydra/Magento2-UCache)[ Packagist](https://packagist.org/packages/masterzydra/magento2-ucache)[ RSS](/packages/masterzydra-magento2-ucache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (1)

Magento2 Universal Cache
========================

[](#magento2-universal-cache)

In Magento2 there are a lot of caches built into the system (configuration, layouts, page cache, etc).
But what if you want to cache a string? Which cache can you use? This package could be the answer.

**Content**

- [Usage](#usage)
- [Clean/Flush cache](#cleanflush-cache)
- [Installation](#installation)
- [Updating to latest version](#updating-to-latest-version)

Usage
-----

[](#usage)

The values are stored in a table in the database. The getter and setter will serialize/deserialize the given value.

```
class Demo {
    public function __construct(
        private \MasterZydra\UCache\Helper\UCache $ucache,
    ) { }

    public function doWork()
    {
        // Add a value to the cache
        $this->ucache->save('myModule_cacheKey', ['some' => 'array']);
        // Load a cache key
        $value = $this->ucache->load('myModule_cacheKey');
        // Remove a single cache entry
        $this->ucache->remove('myModule_cacheKey');
        // Flush the entire UCache
        $this->ucache->clean();

        // Cache value for 30 seconds
        $this->ucache->remember('myModule_cacheKey', 30, function () { return 42; });
        // Cache value forever
        $this->ucache->rememberForever('myModule_cacheKey', function () { return 42; });

        // "remember" and "rememberForever" can also be used with functions with arguments
        // The values to pass when the function is called are passed as an array.
        $value = $this->ucache->remember(
            'customerGroupColl',
            10,
            function (CollectionFactory $collFactory, LoggerInterface $logger) {
                $logger->error('remember customer groups');
                return $collFactory->create();
            },
            [$this->collFactory, $this->logger]
        );
    }
}
```

Clean/Flush cache
-----------------

[](#cleanflush-cache)

### Module specific CLI commands

[](#module-specific-cli-commands)

You can use the flush command provided by this package to flush the cache.

```
# Flush cache
$ php bin/magento ucache:flush

# Remove a specific cache key
$ php bin/magento ucache:flush myCacheKey

# Remove all cache keys matching a given regex
$ php bin/magento ucache:flush -r ^myPrefix
```

### Magento default CLI commands

[](#magento-default-cli-commands)

You can use the default Magento CLI commands to clean or flush the cache.

> **Note:** The UCache must be enabled in order for the CLI commands to work properly.

> Using the cache in your project will always work, even if it is marked as disabled.

```
# Clean cache
$ php bin/magento cache:clean
$ php bin/magento cache:clean ucache

# Flush cache
$ php bin/magento cache:flush
$ php bin/magento cache:flush ucache

# Enable cache
$ php bin/magento cache:enable ucache
```

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

[](#installation)

This Magento2 module can be installed using composer:
`> composer require masterzydra/magento2-ucache`

To remove it from the list of required packages use the following command:
`> composer remove masterzydra/magento2-ucache`

Updating to latest version
--------------------------

[](#updating-to-latest-version)

With the following command composer checks all packages in the composer.json for the latest version:
`> composer update`

If you only want to check this package for newer versions, you can use
`> composer update masterzydra/magento2-ucache`

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance46

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

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

Total

5

Last Release

406d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb8b8450a7a9abe3de10bc9420023bc1b7deac8c3487821b01ba54be07de85c9?d=identicon)[MasterZydra](/maintainers/MasterZydra)

---

Top Contributors

[![MasterZydra](https://avatars.githubusercontent.com/u/44842054?v=4)](https://github.com/MasterZydra "MasterZydra (6 commits)")

---

Tags

cachingmagento2magento2-extensionmagento2-modulemagentocachemagento2General CacheUniversal Cache

### Embed Badge

![Health badge](/badges/masterzydra-magento2-ucache/health.svg)

```
[![Health](https://phpackages.com/badges/masterzydra-magento2-ucache/health.svg)](https://phpackages.com/packages/masterzydra-magento2-ucache)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[redchamps/module-easy-cache-clean

Clean invalidated cache(s) easily in a Magento 2 store

2838.0k](/packages/redchamps-module-easy-cache-clean)[enqueue/magento2-enqueue

Message Queue solutions for Magento2. Supports RabbitMQ, AMQP, STOMP, Amazon SQS, Kafka, Redis, Google PubSub, Gearman, Beanstalk, Google PubSub

4918.8k](/packages/enqueue-magento2-enqueue)[yireo/magento2-autoflushcache

2813.5k](/packages/yireo-magento2-autoflushcache)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

119.1k](/packages/opengento-module-category-import-export)

PHPackages © 2026

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