PHPackages                             sanchescom/laravel-cache-memory - 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. sanchescom/laravel-cache-memory

ActiveLibrary[Caching](/categories/caching)

sanchescom/laravel-cache-memory
===============================

Memory cache driver.

1.1.1(2y ago)71.3k4MITPHPPHP ^7.3|^8.0

Since Oct 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sanchescom/laravel-cache-memory)[ Packagist](https://packagist.org/packages/sanchescom/laravel-cache-memory)[ Docs](https://github.com/sanchescom/laravel-cache-memory)[ RSS](/packages/sanchescom-laravel-cache-memory/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

Laravel Cache Memory
====================

[](#laravel-cache-memory)

Laravel cache memory driver which use shared memory functions.

Shmop is an easy to use set of functions that allows PHP to read, write, create and delete Unix shared memory segments.

Shared memory an IPC1 mechanism native to UNIX. In essence, it’s about two processes sharing a common segment of memory that they can both read to and write from to communicate with one another.

Locks and semaphores are used to ensure atomic access so that multiple PHP processes can concurrently use the same shared memory safely.

Installing
----------

[](#installing)

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

```
composer require sanchescom/laravel-cache-memory
```

### Laravel 5.x:

[](#laravel-5x)

After updating composer, add the ServiceProvider to the providers array in `config/app.php`

```
'providers' => [
   ...
   Sanchescom\Cache\MemoryServiceProvider::class,
],
```

### Lumen:

[](#lumen)

After updating composer add the following lines to register provider in `bootstrap/app.php`

```
$app->register(Sanchescom\Cache\MemoryServiceProvider::class);
```

Configuration
-------------

[](#configuration)

Put new driver in `config/cache.php` and set key and size for memory:

```
    'memory' => [
        'driver' => 'memory',
        'key' => env('MEMORY_BLOCK_KEY', 1),
        'size' => env('MEMORY_BLOCK_SIZE', 900000),
    ],
```

#### Put data to memory in one process

[](#put-data-to-memory-in-one-process)

```
