Cancelado

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

Hi,

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')

->setMaxResults(1)

# pass predis object as driver

->setResultCacheDriver($predis)

# set cache lifetime

->setResultCacheLifetime($cache_lifetime)

->getResult();

}

}

--------------------

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:

--------------------

doctrine:

...

orm:

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

snc_redis:

# configure predis as client

clients:

default:

type: predis

alias: default

dsn: "%redis_host%"

# configure doctrine caching

doctrine:

metadata_cache:

client: default

entity_manager: default

document_manager: default

result_cache:

client: default

entity_manager: default

query_cache:

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 http://bit.ly/1zstTIo

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