Caching design about the part of data
Posted: Thu Sep 02, 2010 3:58 am
About this cache, normally, there are two way to choose in php,
the first, just like the memcache with the memory,
the second, it be a file in hard disk.
Ok, now , i cannot use this first scheme base on the server, but i have some data of the category of the article to be stored with an array by caching , as the following to show.
i saved as a php file in the hard disk, if want to use it just include that file is ok.
however, something that confusing to me,what if the number of cache files in the hard disk be increased day by day, what if the record of data in a cache file be more and more,
the circumstance that the disk space is not sufficient,
but the database is still more free space , i created a table and call name is cache_table, let it store the cache data instead of file caching in the hard disk, i think it is the third way to solve this problem , whereas it generate another problem that need some time when the php connect the database, this is why i counld be confused.
if you encounter this situation, how to do , thanks to good idea or improvement suggestion.
the first, just like the memcache with the memory,
the second, it be a file in hard disk.
Ok, now , i cannot use this first scheme base on the server, but i have some data of the category of the article to be stored with an array by caching , as the following to show.
Code: Select all
$cache_category = array(
1 => array('name' => 'php', description => 'something here'),
2 => array('name' => 'mysql', description => 'something here'),
3 => array('name' => 'css', description => 'something here'),
4 => array('name' => 'html', description => 'something here'),
5 => array('name' => 'js', description => 'something here'),
//perhaps it remain about ten more rows currently
);however, something that confusing to me,what if the number of cache files in the hard disk be increased day by day, what if the record of data in a cache file be more and more,
the circumstance that the disk space is not sufficient,
but the database is still more free space , i created a table and call name is cache_table, let it store the cache data instead of file caching in the hard disk, i think it is the third way to solve this problem , whereas it generate another problem that need some time when the php connect the database, this is why i counld be confused.
if you encounter this situation, how to do , thanks to good idea or improvement suggestion.