Using cache in php script

后端 未结 1 1539
死守一世寂寞
死守一世寂寞 2021-01-21 22:12

I have a confusion about cache in php. I created a file for display 2 to 500 in my php file. Now I want to use the cache file for storing the data and display it. My code is bel

相关标签:
1条回答
  • 2021-01-21 22:54

    There are several forms of caching from within PHP.

    If you have access to memcached or APC on your webhost (some shared plans disable this functionality), look them up as they are considered fairly high-performance forms of caching as it utilizes the system memory directly (memcached is more suited for distributed systems).

    http://php.net/manual/en/book.memcache.php

    http://php.net/manual/en/book.apc.php

    If not, look into file caching. PHP comes with a handy file library (documented within the PHP documentation) which will allow you to read/write to files.

    http://www.php.net/manual/en/ref.filesystem.php

    Lastly, you may look into SQL caching. Although this is not typically recommended in comparison to the other options, data that you wish to store through a database may be an option as well (if you need to link it to other data from within your tables).

    http://php.net/manual/en/ref.pdo-mysql.php

    Good luck!

    0 讨论(0)
提交回复
热议问题