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

Make $app['db.orm.cache'] return a new instance #10

Open
itavero opened this issue May 13, 2012 · 0 comments
Open

Make $app['db.orm.cache'] return a new instance #10

itavero opened this issue May 13, 2012 · 0 comments

Comments

@itavero
Copy link
Contributor

itavero commented May 13, 2012

Wouldn't it be better to change line 61 of DoctrineORMServiceProvider.php from this:

    'cache'    => new ArrayCache,

to this?

    'cache'    => function(){ return new ArrayCache(); },

That way the ArrayCache is only initialized once it's assigned to the Configuration (and it isn't when the user decides to use a different cache driver). It also ensures that the different aspects that can be cached (Query, Metadata and Result) aren't using the same cache, which is a good thing, right?

If we would want to share the same instance, we could also change it to $app->share( /* function above */ ).

I also suggest putting this approach in the README.md, as the recommended way to set a cache driver in the configuration.

I'd love to hear your opinion on all of this.

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