• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cache library

#18
[eluser]displaynone[/eluser]
I would like to suggest an improvement. If your application has to cache a huge amount of data, you can get directory problems (a lot of files in the same directory), so it's a good idea to organizate the cache files in directories, p.e.:

[cache_path]/2/29/29df3630cbe4818d0569b346c527317f.cache
[cache_path]/2/29/29df3630cbe4818d0569b346c527317f.exp

So, I make this change:

Code:
function _file($cache_id, $cache_group = NULL)
{
  $hash = md5($cache_id);
  $path = $this->_group_dir($cache_group).'/'.substr($hash, 0, 1).'/'.substr($hash, 0, 2).'/';
  @mkdir($path, 0777, true);
  return $path.$hash;
}

Sorry form my english Wink


Messages In This Thread
Cache library - by El Forum - 07-24-2007, 01:22 AM
Cache library - by El Forum - 07-24-2007, 07:02 AM
Cache library - by El Forum - 07-25-2007, 04:01 AM
Cache library - by El Forum - 07-25-2007, 09:30 AM
Cache library - by El Forum - 07-25-2007, 10:03 AM
Cache library - by El Forum - 07-26-2007, 01:57 AM
Cache library - by El Forum - 07-26-2007, 12:49 PM
Cache library - by El Forum - 07-26-2007, 12:55 PM
Cache library - by El Forum - 08-13-2007, 01:33 PM
Cache library - by El Forum - 12-28-2007, 04:44 AM
Cache library - by El Forum - 02-24-2008, 12:24 AM
Cache library - by El Forum - 07-18-2008, 03:13 AM
Cache library - by El Forum - 12-17-2008, 04:38 PM
Cache library - by El Forum - 12-17-2008, 05:19 PM
Cache library - by El Forum - 06-11-2009, 12:09 AM
Cache library - by El Forum - 09-18-2009, 02:02 PM
Cache library - by El Forum - 11-04-2009, 03:12 AM
Cache library - by El Forum - 04-12-2011, 02:40 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.