2017 © Pedro Peláez
 

symfony-bundle in-memory-list-bundle

PHP Bundle

image

mauretto78/in-memory-list-bundle

PHP Bundle

  • Tuesday, January 16, 2018
  • by mauretto78
  • Repository
  • 1 Watchers
  • 0 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

In-Memory List Bundle

SensioLabsInsight Codacy Badge license Packagist, (*1)

This is the official Symfony bundle for In-Memory List package., (*2)

Install Guide

Step 1: Include In-Memory List Bundle in your project with composer:

composer require mauretto78/in-memory-list-bundle

Step 2: Setup your config.yml to configure your driver and connection parameters

Here is an example:, (*3)

# In Memory List
in_memory_list:
    driver: 'redis'
    parameters:
        scheme: 'tcp'
        host: '127.0.0.1'
        port: '6379'
        options:
          profile: '3.2'

Please refer to In-Memory List page for more details., (*4)

Step 3: Setup your AppKernel.php by adding the InMemoryList Bundle

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

Step 4: Setup yor routing_dev.yml

Add these lines at the bottom of your routing_dev.yml file:, (*5)

_inmemorylist:
    resource: '@InMemoryListBundle/Resources/config/routing.yml'

Usage Guide

Caching data in your controller:, (*6)

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,
    ]);
}

Now you can loop data in your twig files:, (*7)

{% for item in cachedList %}
    <li>{{ item.userId }}</li>
    <li>{{ item.id }}</li>
    <li>{{ item.title }}</li>
    <li>{{ item.body }}</li>
{% endfor %}

Symfony Profiler

You can manage cached lists through the Symfony Profiler:, (*8)

Symfony Profiler, (*9)

Support

If you found an issue or had an idea please refer to this section., (*10)

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*11)

The Versions

21/06 2017

v1.0.6

1.0.6.0 https://github.com/mauretto78/in-memory-list-bundle

PHP Bundle

  Sources   Download

MIT

The Requires

 

cache php redis memcached bundle symfony list apcu in-memory

16/06 2017

v1.0.5

1.0.5.0 https://github.com/mauretto78/in-memory-list-bundle

PHP Bundle

  Sources   Download

MIT

The Requires

 

cache php redis memcached bundle symfony list apcu in-memory

14/06 2017

v1.0.4

1.0.4.0 https://github.com/mauretto78/in-memory-list-bundle

PHP Bundle

  Sources   Download

MIT

The Requires

 

cache php redis memcached bundle symfony list apcu in-memory

09/06 2017

v1.0.1

1.0.1.0 https://github.com/mauretto78/in-memory-list-bundle

PHP Bundle

  Sources   Download

MIT

The Requires

 

cache php redis memcached bundle symfony list apcu in-memory

09/06 2017

v1.0.0

1.0.0.0 https://github.com/mauretto78/in-memory-list-bundle

PHP Bundle

  Sources   Download

MIT

The Requires

 

cache php redis memcached bundle symfony list apcu in-memory