How can you make such a topic:

When you first enter the site, the site setup data is taken from the database.

These settings are the same for all visitors, so rummaging into the database every time and loading it does not make much sense

You can save to the file, but every time you need to read the file by twisting the hard drive, and if it is still very busy scrolling through other files, then this is not very effective

How can you save data in RAM and take it from there?

    3 answers 3

    if your server, then you can make a virtual disk in memory. it is done simply:

    mkdir /mnt/myramdisk mount -t tmpfs /mnt/myramdisk -o size=100m 

    100m is the size of the disk.
    tmpfs - file system type

    • super and on it what I place will be stored in RAM? - fdhfgdjhgfdjf
    • Yes, but consider, if suddenly the server reboots, then all data will be lost. But in principle, how the cache may well fit. and of course it is under the nix. under Windows you can find programs here - thunder
    • Note that if the RAM is not enough, then the virtual disk data will start to be swapped out to the swap (to the real disk), and when re-accessed, it will be re-read from there. The difference with regular files is that if the system is not loaded, nothing is written to the disk (unlike changing regular files). But only on a relatively unbooted system, this recording (normal files) on the disk does not interfere with anything (it is made as if in the background). - avp

    use Alternative PHP Cache (APC) or use memcached

      I used memcache + apc, which I advise you.

      memcache for data caching,

      apc - for PCP caching

      • In general, yes, it is better to use them. but since the question was about the RAM, then ...;) - thunder
      • Yes, actually and on the whole it wouldn’t hurt it. So there was an idea about how to unload the server in a simple way. But it’s a pity that PCH doesn’t work with RAM - dfhsfhgfj