RoadRunner Key-Value Cache for Laravel

Packages

July 11th, 2023

RoadRunner Key-Value Cache for Laravel

The Roadrunner KV Cache package for Laravel allows you to work with the RoadRunner Key-Value Plugin as a Cache driver:

use Illuminate\Support\Facades\Cache;
 
// Default main store - rr-memory
Cache::driver()->get('key');
 
// rr-boltdb store
Cache::driver('rr-boltdb')->get('key');

The Key-Value plugin allows storing arbitrary data inside RoadRunner between different HTTP requests or other types of applications like a CLI.

Through Roadrunner, this package supports in-memory storage and the boltdb driver if you need persistent storage. It also supports end-to-end encrypted serialization if you have data that may contain sensitive information, such as personal user data.

Like any cache driver, you can configure multiple options with RoadRunner's Key-Value driver. Here are some example configuration options from the cache config examples in the readme:

<?php
return [
'default' => 'rr-memory', // Default store (optional)
 
'stores' => [
'rr-memory' => [ // Custom store name with "memory" connection
'driver' => 'roadrunner',
'connection' => 'memory', // section name from KV plugin settings in RoadRunner config file (.rr.yaml)
'serializer' => null, // Available options: null|igbinary
'encryption_key' => null, // Available options: null|string
],
'rr-memory-igbinary-encrypted' => [ // Custom store name with "memory" connection and encrypted "igbinary" serializer
'driver' => 'roadrunner',
'connection' => 'memory', // section name from KV plugin settings in RoadRunner config file (.rr.yaml)
'serializer' => 'igbinary', // Available options: null|igbinary
'encryption_key' => 'key1', // Available options: null|string
],
'rr-memory-encrypted' => [ // Custom store name with "memory" connection and encrypted serializer
'driver' => 'roadrunner',
'connection' => 'memory', // section name from KV plugin settings in RoadRunner config file (.rr.yaml)
'serializer' => null, // Available options: null|igbinary
'encryption_key' => 'key2', // Available options: null|string
],
],
],

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.