PHPackages                             cursedcoder/dark-redis-list-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cursedcoder/dark-redis-list-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

cursedcoder/dark-redis-list-bundle
==================================

Symfony2 bundle which allows you to store part of doctrine entities data in Redis.

5132PHP

Since Mar 12Pushed 13y ago2 watchersCompare

[ Source](https://github.com/cursedcoder/DarkRedisListBundle)[ Packagist](https://packagist.org/packages/cursedcoder/dark-redis-list-bundle)[ RSS](/packages/cursedcoder-dark-redis-list-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

DarkRedisListBundle [![Build Status](https://camo.githubusercontent.com/5d63ffcc0fb4e4723349bc39c293c1c56def97fa6f77ba4c7758f82309ff036b/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f637572736564636f6465722f4461726b52656469734c69737442756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/cursedcoder/DarkRedisListBundle)
=============================================================================================================================================================================================================================================================================================================================================================

[](#darkredislistbundle-)

Symfony2 bundle which allows you to store part of doctrine entities data in Redis. For more information please read text below.

### How do we manage lists at MySQL:

[](#how-do-we-manage-lists-at-mysql)

- write query, for example 'SELECT a FROM MyTestBundle:Post a ORDER BY a.created\_at'
- use doctrine repository

then we can pass it to the paginator, but no need to talk about it now.

### But I need more functionality to those lists:

[](#but-i-need-more-functionality-to-those-lists)

- combine few entity types at one list\\query
- retrieve real-time result
- use permanent cache for each entitiy
- it's should be fast

### Introducing to Redis Lists

[](#introducing-to-redis-lists)

Redis List — it's structured data, that is stored in Redis hashes (do not confuse native Redis lists with ours). Okay, let's learn more about this.

### What Redis List is?

[](#what-redis-list-is)

Each list have name, for example — 'View', each element of this hash has unique ID and it contains some value.

Here is example of Redis List:

```
Hash  ID   Value
View — 1 — SonataBadBundle:Post;1
View — 2 — SonataBadBundle:Post;2
View — 3 — SonataBadBundle:Post;3
View — 4 — KnpGoodBundle:Article;1
View — 5 — MyPromoBundle:Promo;1

```

So, as you can see that each hash:

- starts from 1 id
- all ids are holistic (count of all elements = last element id)

Okay, but how it's can satisfy my requirements?

```
Each element of Redis List contains information about entities — repository name, id.
I can fetch those entities through repository, and then cache it in Memcached for example.

```

### Features which it gives to you:

[](#features-which-it-gives-to-you)

- real-time list result
- can store entities in cache permanently
- if new element passed to list, no need to reload old entities from DB
- it allows to list a few types of entities as one list
- it allows to list random entities from list freely, cuz ids are holistic, and also no need to fetch them from DB

Installation
------------

[](#installation)

Add DarkRedisListBundle in your composer.json

```
{
    "require": {
        "cursedcoder/dark-redis-list-bundle": "*"
    }
}
```

Register the bundle in your `app/AppKernel.php`:

```
