Result caching in Redis of query in an EntityRepository using Doctrine/Symfony2


We have an application in symfony2 and would like to add result caching of query results in Redis through Doctrine.

In our research we found Snc\RedisBundle and Predis combination, but have no experience with these bundles.

We are looking for a developer to prepare this for us to implement in our existing symfony application.

Sample of the code how we would like to implement:


class BlogRepository extends EntityRepository


public function findMostRecentBlog()


# init predis client

$predis = new RedisCache();

$predis->setRedis(new Client());

# define cache lifetime period as 1 hour in seconds

$cache_lifetime = 3600;

return $this->getEntityManager()

->createQuery('SELECT b FROM repository b')


# pass predis object as driver


# set cache lifetime






The Redis host needs to be able to set through parameters/config , as it will change depending on our environment.

The kind of settings we want in our [url removed, login to view] are:





auto_generate_proxy_classes: "%[url removed, login to view]%"

auto_mapping: true

metadata_cache_driver: redis

query_cache_driver: redis

result_cache_driver: redis

# Redis configuration


# configure predis as client



type: predis

alias: default

dsn: "%redis_host%"

# configure doctrine caching



client: default

entity_manager: default

document_manager: default


client: default

entity_manager: default


client: default

entity_manager: default


If you have any suggestions for different methods for example, please don't hesitate to let us know and suggest.

Before we award the project, we need a sample to see that you have experience in this area.

Requested by some freelancers > code of demo test symfony project that we are testing this new feature with.
You can check the EnalityBundle > EntityRepository, this is where the code snippet from briefing is taken from.

Upload was too large, please download from Google Drive

Habilidades: PHP, Redis, Arquitetura de software, Symfony PHP

Veja mais: need a developer for an hour, driver select, define php developer, symfony 1, redis, kernel driver, dsn, doctrine orm, symfony2 project, pass query, symfony2 project code, php redis, symfony sample project, symfony project example, configure existing symfony project, query class, php orm, configure cache, symfony project, kernel developer

Acerca do Empregador:
( 32 comentários ) Dubai, United Arab Emirates

ID do Projeto: #7171014