Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question : how to set redis options ? #73

Open
davidbarre opened this issue Mar 23, 2016 · 1 comment
Open

question : how to set redis options ? #73

davidbarre opened this issue Mar 23, 2016 · 1 comment

Comments

@davidbarre
Copy link

Hi,

I try to set this redis option in my provider declaration :

  • host
  • port
  • password
    but It doesn't work, I got this error

Uncaught exception 'RuntimeException' with message 'Host and port options need to be specified for redis cache'

Where I have to set this option ?
Thanks for your answers.

I try this :

$app->register(new DoctrineOrmServiceProvider(), array(
    'orm.proxies_dir' => __DIR__."/../../cache/doctrineProxies",
    'orm.proxies_namespace' => $app['env'],
    'orm.auto_generate_proxies' => $app['debug'],
    'orm.default_cache' => getenv('REDIS_CACHE') ? 'redis' : 'array',
    'host' => getenv('REDIS_HOST'),
    'port' => getenv('REDIS_PORT'),
    'password' => getenv('REDIS_PASSWORD'),
    'orm.em.options' => array(
        'cache_namespace' => $app['env'].'_',
        'mappings' => array(
            array(
                'type' => 'annotation',
                'namespace' => 'Models',
                'path' => '',
            ),
        ),
    ),
));

also this

$app->register(new DoctrineOrmServiceProvider(), array(
    'orm.proxies_dir' => __DIR__."/../../cache/doctrineProxies",
    'orm.proxies_namespace' => $app['env'],
    'orm.auto_generate_proxies' => $app['debug'],
    'orm.default_cache' => getenv('REDIS_CACHE') ? 'redis' : 'array',
    'orm.em.options' => array(
        'cache_namespace' => $app['env'].'_',
        'host' => getenv('REDIS_HOST'),
        'port' => getenv('REDIS_PORT'),
        'password' => getenv('REDIS_PASSWORD'),
        'mappings' => array(
            array(
                'type' => 'annotation',
                'namespace' => 'Models',
                'path' => '',
            ),
        ),
    ),
));
@davidbarre davidbarre changed the title question : how to set redis option ? question : how to set redis options ? Mar 23, 2016
@davidbarre
Copy link
Author

OK I find the right syntax...

$app->register(new DoctrineOrmServiceProvider(), array(
    'orm.proxies_dir' => __DIR__."/../../cache/doctrineProxies",
    'orm.proxies_namespace' => $app['env'],
    'orm.auto_generate_proxies' => $app['debug'],
    'orm.default_cache' => array(
        'driver' => 'redis', 
        'host' => getenv('REDIS_HOST'),
        'port' => getenv('REDIS_PORT'),
        'password' => getenv('REDIS_PASSWORD'),
   ),
   'orm.em.options' => array(
        'cache_namespace' => $app['env'].'_',
        'mappings' => array(
            array(
                'type' => 'annotation',
                'namespace' => 'Models',
                'path' => '',
            ),
        ),
    ),
));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant