mageproger/mongocache

Laravel cache MongoDB driver library

dev-master 2022-06-26 18:03 UTC

This package is auto-updated.

Last update: 2024-04-26 22:01:55 UTC


README

This extension allows to store cache in MongoDB like memcache, redis, etc. in Laravel

Installation

The preferred method of installing this library is with Composer by running the following from your project root:

$ composer require mageproger/mongocache

Laravel without auto-discovery:

If you don't use auto-discovery, add the CacheServiceProvider to the providers array in config/app.php

Mageproger\MongoCache\MongoCacheServiceProvider::class,

Copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="Mageproger\MongoCache\MongoCacheServiceProvider"

Add config to config/cache.php:

'mongo' => [
            'driver' => 'mongo',
            'host' => env('MONGO_HOST'),
            'database' => env('MONGO_DATABASE'),
            'username' => env('MONGO_USERNAME'),
            'password' => env('MONGO_PASSWORD'),
            'collection' => env('MONGO_COLLECTION'),
            'prefix' => env('MONGO_PREFIX', ''),
        ],

Use cache as usual