I've been lately trying to solve this puzzle. Which one is faster, caching in files or in a database?
Right now I have a file based caching.
Code: Select all
$db -> exec(3600*24); // time to live aka expirationCode: Select all
$db -> exec(0); // false/0 = no cachingI was now thinking, what if I cache into the database? I'm not caching SQL results in a db, but I would cache other vital information. I could create a PHP file containing lets say an array of 500 rows OR I could insert them to a database. But which one is faster to load? Loading the data from this arrayed file or from a database?