Forum: Ruby on Rails Solution for multilanguage caption lookup speed improvement?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Marcus O. (Guest)
on 2006-02-11 01:33
In my Rails app i have a helper method called "translate":

def translate(name)
  tran = Translation.find_by_name(name)

As you can see, the method does a lookup in the table "Translation",
where i have an index in the field "name".
This is working well, but in a single page i can have dozens of captions
to translate, and there are several concurrent users, so the whole thing
slows a bit.
I guess preloading the Translation table in a Hashtable would help, but
i wouldn't load this hash table in each user session: how can i use a
single Hashtable per Server instance ?

Also, with many users i -randomly- have a "MySQL lost connection
error".I guess finding a solution for the lookup could avoid having this

This topic is locked and can not be replied to.