PHP code example of asanikovich / laravel-roadrunner-cache

1. Go to this page and download the library: Download asanikovich/laravel-roadrunner-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asanikovich / laravel-roadrunner-cache example snippets



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-boltdb' => [ // Custom store name with "boltdb" connection (another store is optional)
            'driver' => 'roadrunner',
            'connection' => 'boltdb', // 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
            'prefix' => 'custom', // Custom prefix - non-empty-string
        ],
        'rr-memory-igbinary' => [ // Custom store name with "memory" connection and "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' => 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
        ],
    ],
]


    use Illuminate\Support\Facades\Cache;

    Cache::driver()->get('key'); // Default main store - rr-memory
    Cache::driver('rr-boltdb')->get('key'); // rr-boltdb store
yaml
version: '3'
rpc:
  listen: 'tcp://127.0.0.1:6001'
server:
  command: php /var/www/html/vendor/bin/roadrunner-worker
http:
  address: '127.0.0.1:8080'
  pool:
    num_workers: 1
kv:
    memory:
        driver: memory
        config:
            interval: 1
    boltdb:
        driver: boltdb
        config:
            interval: 1
bash
php artisan vendor:publish --tag="laravel-roadrunner-cache-config"