Storing them as _SESSION variables will affect each user between page loads, not across multiple users accessing the system at the same time.

As long as your tables are properly indexed and you're not hitting the DB for each individual replacement term, you are not going to incur massive overhead by going to the DB multiple times. If you are concerned, you might look into using APC for caching, or even using a translation file for storing each language instead of a database.

KyleWolfe
—
2013-02-20T02:45:41Z —
#4

santouras said:

Storing them as _SESSION variables will affect each user between page loads, not across multiple users accessing the system at the same time.

As long as your tables are properly indexed and you're not hitting the DB for each individual replacement term, you are not going to incur massive overhead by going to the DB multiple times. If you are concerned, you might look into using APC for caching, or even using a translation file for storing each language instead of a database.

Yup, +1. If you want them in memory, a properly indexed table / query is really the only way to go.

Michael_Morris1
—
2013-02-20T03:06:25Z —
#5

MySQL and most other DB engines have memcaches for the results of the most frequently ran queries, so without even touching the PHP code you can increase caching of the results by increasing the db engines' cache size. Within PHP itself there is APC and memcache. A final trick is to mount a RAM disk on your server and have PHP write to a file on that ram disk.

MySQL and most other DB engines have memcaches for the results of the most frequently ran queries, so without even touching the PHP code you can increase caching of the results by increasing the db engines' cache size. Within PHP itself there is APC and memcache. A final trick is to mount a RAM disk on your server and have PHP write to a file on that ram disk.

I would go this route as well. You can also manually store via APC and memcached as well. APC does a pretty good job of automatic caching with minimal configuration.

Serenarules
—
2013-02-20T18:33:49Z —
#8

The problem with application scoping and PHP is that one cannot tell is a given session is the first or last, in order to facilitate proper cleanup. While you can write a counter to file, you probably shouldn't. Also, keep in mind the following things:

1) Memory is not share between machines, therefore, a later move to a cluster could potentially cause problems.2) Users of different sessions may have selected different languages/locales, and sharing this across all sessions would pose problems.

I post this information as further support for the db solution.

What I would do, however, is group certain phrases into phrasegroups in order to facilitate seletion of only the conversions you'll need. E.G. put all common phrases in a group, all phrases used on the login screen in a group.