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

Adding "cache_namespace" key in "orm.em.options" #16

Closed
wants to merge 2 commits into from
Closed

Adding "cache_namespace" key in "orm.em.options" #16

wants to merge 2 commits into from

Conversation

asiermarques
Copy link

In reference to issue #15

When you have many web applications in the same server, it is necessary to configure a suffix in the APC cache in order to avoid cache conficts between applications.

With this patch, you can configure it in this way:

    $app->register(new Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider, array(
        "orm.em.options" => array(
            "cache_namespace" => "appname_",
            "metadata_cache" => "apc",
            "query_cache"    => "apc",
            "mappings" => array(
                array(),
            ),
        ),
    ));

This configuration can be specified with the "cache_namespace" key in "orm.em.options"
@simensen
Copy link
Member

Thanks for working on this. I think I'd prefer this be formatted another way. I won't make you worry about it, though. :) I'll share what I work on and you can sign off before I merge it.

simensen added a commit to simensen/dflydev-doctrine-orm-service-provider that referenced this pull request Sep 16, 2013
If `cache_namespace` is set, `setNamespace` will be called on the resulting
cache instance if it is a Doctrine CacheProvider instance. Doctrine's
CacheProvider will take care of normalizing this call for various backends
based on its own rules.

    $app->register(
        new Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider,
        array(
            'orm.em.options' => array(
                'cache_namespace' => 'appname_',
                'metadata_cache' => 'apc',
                'query_cache'    => 'apc',
                'mappings' => array(
                    array(),
                ),
            ),
        )
    );

Thanks to @asiermarques for this work.

Closes dflydev#15
Closes dflydev#16
@simensen
Copy link
Member

@asiermarques Please see #17 and let me know your thoughts. Thanks!

@asiermarques
Copy link
Author

@simensen It works very well for me, thanks to you!

@simensen simensen closed this in #17 Sep 17, 2013
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

Successfully merging this pull request may close these issues.

2 participants