Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Yii2 Redis Laravel Package

yiisoft/yii2-redis

Yii2 Redis extension providing Redis-backed cache, mutex, and session handlers plus an ActiveRecord layer for storing and querying structured data in Redis. Requires Redis 2.6.12+ and PHP 7.4+ (best on PHP 8).

View on GitHub
Deep Wiki
Context7

Using the Mutex component

To use Redis for your application’s mutex locks, you must configure the mutex component to be an instance of [[yii\redis\Mutex]], in addition to configuring the connection (as described in the Installation section):

return [
    // ...
    'components' => [
        // ...base `redis` component definition...
        'mutex' => [
            'class' => yii\redis\Mutex::class,
        ],
    ]
];

By default, yii\redis\Mutex uses the globally-configured redis connection component.

If you plan on using Redis for more than one component, configure your connection directly on the mutex component:

return [
    //....
    'components' => [
        // ...
        'mutex' => [
            'class' => yii\redis\Mutex::class,
            'redis' => [
                'class' => yii\redis\Connection::class,
                'hostname' => 'localhost',
                'port' => 6379,
                'database' => 1,
            ],
        ],
    ]
];

Note that the connection explicitly designates database 1 for mutex locks. To avoid inadvertent flushing of the cache or sessions, each component should be configured with a different database.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity