PHP code example of hesam1996 / laravel-redis-entity

1. Go to this page and download the library: Download hesam1996/laravel-redis-entity 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/ */

    

hesam1996 / laravel-redis-entity example snippets


$productEntity = new ProductRedisEntity();

$products = $productEntity->getAll();      // first call → DB, next calls → Redis
$product = $productEntity->get(42);       // single record

$productEntity->set('42', [...]);
$productEntity->forget('42');
$productEntity->clear();       // invalidate cache, next read re-warms from DB
bash
php artisan redis-entity:make sessions
bash
php artisan redis-entity:make products --model=Product