Every time I get to the authentication page, I notice that the developer issues an SQL statement:
User load (0.2ms) SELECT users . * FROM users WHERE ( users . id = 1) LIMIT 1
(I use Rails 3 btw .. therefore cache_money seems like a solution, and despite a lot of searches, I did not find a replacement).
I tried many overrides in the user model and only called find_by_sql. To whom the string of the entire SQL statement is passed. Something intuitive like find_by_id or find does not seem to be called. I can "override this method and get the user ID and make a reasonable caching system out of it, but it's pretty ugly.
I also tried overriding authenticate_user, which I can intercept one SQL attempt, but then calls to current_user seem to try again.
Itβs just that my user objects rarely change, and his sad state continues to beat db for this instead of the memcache solution. (suppose that I am ready to accept all responsibility for the invalidity of the specified cache: after_save as part, but not all of this solution)
source share