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

Cache users groups on demand to prevent multiple sql queries #308

Merged
merged 2 commits into from
Sep 20, 2012

Conversation

Dentxinho
Copy link
Contributor

Several calls to in_group() don't query the database several times anymore.
Added a on-demand cache of users_groups that looks like this:
[user_id] => array( [group_id] => [group_name], [group2_id] => [group2_name] )

As a new query was added on add_to_group(), on-demand caching of groups was added too. (note: only [group_id] => [group_name]).

Fixes #307

Removed trailing whitespace and tabulation
Several calls to in_group() don't query the database several times
anymore.
Added a on-demand cache of users_groups that looks like this:
[user_id] => array( [group_id] => [group_name], [group2_id] =>
[group2_name] )

As a new query was added on add_to_group(), on-demand caching of groups
was added too. (note: only [group_id] => [group_name]).
@benedmunds
Copy link
Owner

This looks great!

The only issue is all the newline changes.

@Dentxinho
Copy link
Contributor Author

@benedmunds these aren't newline changes. I've removed trailing whitespaces

@benedmunds
Copy link
Owner

Ah ok cool. Thanks, I'll merge this in!

benedmunds added a commit that referenced this pull request Sep 20, 2012
Cache users groups on demand to prevent multiple sql queries
@benedmunds benedmunds merged commit fe3d4c6 into benedmunds:2 Sep 20, 2012
@Dentxinho
Copy link
Contributor Author

Great :)

I don't know if you saw this, but I didn't change mongo_db, because I don't have any experience on this. I only added the cache vars to compatibility.

@benedmunds
Copy link
Owner

I noticed, @sepehr can you take a look at this please?

Thanks!

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.

3 participants