i have a large amount of data that is read from a database and displayed to a user. This data very very rarley ever changes. i was wondering if there is a way to cache the data on the server. i have heard of $_CACHE but i dont know how to use it. is it just like using $_SESSION. do i have to call a function similar to session_start();
to get the cache to create. I want this data to be universal to any user viewing the web page.I think this is what you're after: Alternative PHP Cache (<!-- m --><a class="postlink" href="http://us2.php.net/apc">http://us2.php.net/apc</a><!-- m -->)Storing Table Data in Memory.
Have never tried it myself though.
<!-- m --><a class="postlink" href="http://www.databasejournal.com/features/mysql/article.php/3077531bad">http://www.databasejournal.com/features ... 3077531bad</a><!-- m --> advice, storing table data in HEAP/Memory tables - will kill all your RAM
You can use PHP cache but need to install new module, U can use also PHP Smarty Engine, or any other template engine, what support caching. So kind of cache is very easy to understand and organise by yourself. U need just STORE this data in files. so before query database you are checking directory - if there are so FILE with data with so query ID - if yeah, you put data from THIS FILE not from DB - if nope you query DB. You can also use TTL Expire for you own maden cache. E.g. if current time subtract file created date and the given number more than TTL expire time, then this cache EXPIRED and you need to query database again.best thing for you to do is switch on the mysql query caching, that is if the server is not shared by someone else. please read under query caching at mysql.com
to get the cache to create. I want this data to be universal to any user viewing the web page.I think this is what you're after: Alternative PHP Cache (<!-- m --><a class="postlink" href="http://us2.php.net/apc">http://us2.php.net/apc</a><!-- m -->)Storing Table Data in Memory.
Have never tried it myself though.
<!-- m --><a class="postlink" href="http://www.databasejournal.com/features/mysql/article.php/3077531bad">http://www.databasejournal.com/features ... 3077531bad</a><!-- m --> advice, storing table data in HEAP/Memory tables - will kill all your RAM
You can use PHP cache but need to install new module, U can use also PHP Smarty Engine, or any other template engine, what support caching. So kind of cache is very easy to understand and organise by yourself. U need just STORE this data in files. so before query database you are checking directory - if there are so FILE with data with so query ID - if yeah, you put data from THIS FILE not from DB - if nope you query DB. You can also use TTL Expire for you own maden cache. E.g. if current time subtract file created date and the given number more than TTL expire time, then this cache EXPIRED and you need to query database again.best thing for you to do is switch on the mysql query caching, that is if the server is not shared by someone else. please read under query caching at mysql.com