PHP code example of mauretto78 / in-memory-list-bundle

1. Go to this page and download the library: Download mauretto78/in-memory-list-bundle 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/ */

    

mauretto78 / in-memory-list-bundle example snippets


// ..
$bundles[] = new InMemoryList\Bundle\InMemoryListBundle();

public function indexAction(Request $request)
{
    $simpleArray = json_encode([
        [
            'userId' => 1,
            'id' => 1,
            'title' => 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
            'body' => "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto",
        ],
        [
            'userId' => 1,
            'id' => 2,
            'title' => 'qui est esse',
            'body' => "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla",
        ],
    ]);

    /** @var Cache $cache */
    $cache = $this->container->get('in_memory_list');
    $cachedList = $cache->getClient()->create(json_decode($simpleArray), ['uuid' => 'simple-list', 'ttl' => 1000]);

    // replace this example code with whatever you need
    return $this->render('default/index.html.twig', [
        'cachedList' => $cachedList,
        'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
    ]);
}