Needs review
Project:
User titles
Version:
6.x-1.0-beta5
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Sep 2010 at 18:46 UTC
Updated:
30 Sep 2010 at 16:35 UTC
Jump to comment: Most recent file
Comments
Comment #1
cannandev commentedWoops,
Was using a previous version of User Titles module (6.x-0.1). Upgraded to version 6.x-1.x-dev. Since this version does not do a variable_set('user_titles', $titles) to store titles in the database, implemented static caching in user_titles_get_titles(). Instead of making an additional database call for user_titles by tid, we pull it from the $result array. Also added the $reset parameter to all database queries that change {user_titles}. When true, reloads the titles and bypasses caching.
Comment #2
cannandev commentedAlso added static caching to the user_titles_get_user_title_info(). Checks if the the $user->uid was cached first. Then grabs the title object that was already set or from the database. Now returns false an empty $tid instead of returning the $title object from user_titles_get_titles().
Before the patch, the query on {user_titles_users} was called up to 12 times for each uid and was reduced to one call per uid after.
Comment #3
cannandev commentedThis patch implements static caching on user_titles_get_titles() for beta5 version. Also, once {user_titles} is updated, or a title is added or deleted, user_titles_get_titles(NULL, TRUE) should be called to bypass the cache and populate the $titles object with the latest values from the database.