Hello to all!

For some time now I have been working on a projector, more precisely, a module of one large projector. I use ActiveRecord. We have one table in the database, which is associated with several other tables, there are about 20-30 connections per record, as a result, when displaying 100 objects in the browser, about 500 requests are made to the database, respectively, the page loads from a second to three. This is not good, and fortunately, we were given time to finish and bring our projects to mind. Actually, I decided to fix the stagnation of my system, and start caching. For the sake of interest included caching in files, the speed of the system increased, users noticed it. Moreover, now only the objects themselves are cached, connections to them are not yet cached.

In general, I read on the Internet, gobbled the buzzword memcached, puzzled our administrator to put this miracle on a computer in Eveoperskuyu, and he began to learn how to do the correct caching of ActiveRecord objects in Yii. I hope for your help. Maybe there are some AR caching techniques? In general, for any links, or answers will be grateful)

    1 answer 1

    I will not post all links, only one initial . You need to think about what would revise the architecture of the application, because 20-30 links are, in my opinion, too. Be sure to use lazy loading . You do not need to cache the entire page, but the data obtained from the database (do not forget to divide them into data for an authorized or specific user, data for a guest and others ...), blocks of pages (again, separation!).

    And advice, do not use diminutive words in your speech, otherwise you will not be taken seriously. Project whether it is small or large, it will always be a project!

    • Thank you, but alas, nobody will revise the application architecture, and even more so, nobody will, because more than a year of development has already been invested, and a 7-digit amount of money - nolka
    • I also want to add that memcache is capable of storing 1 megabyte of data in a single cell, so keep in mind. - VasyOk
    • Thank you, valuable advice) I will look for information on How to redefine the ActiveRecord class so that when calling any model inherited from this class, the information is first searched in the cache) - nolka