The cache.class.php includes a cache.class_config.php by default.
If it exists in the same directory.
See the *dist* file and make a copy for your needs.


// set a custom cache direcory
// $this->_sCacheDir="/tmp/ahcache";

// if you have a large number of items to cache:
// you can limit the files per cache subdir in an indirect way
// The cachefile is a md5 hash. you can set a number of max characters
// i.e.
// cachefile     2f9ac50fd254ea4c6462105cb91ee14a.cacheclass2
// with value 8: 2f9ac50f/d254ea4c/6462105c/b91ee14a.cacheclass2
// with value 3: 2f9/ac5/0fd/254/ea4/c64/621/05c/b91/ee1/4a.cacheclass2
// $this->_sCacheDirDivider=16;

By default these options are commented / disabled.
Here you can override...

  • _sCacheDir
    The default directory where to create subdirectories for each module and where to store all cache items.
    default: [webroot]/~cache/
    You don't have a simple shared hosting and can define a directory outside webroot? Then do it!
    If you use the class in a shell script (CLI) and as a webbased cache as well, then set an absolute path here, i.e. /tmp/ahcache/
    The reason is: On CLI the $_SERVER['DOCUMENT_ROOT'] is unknown - so the CLI and a http request won't use the same cache directory.
  • _sCacheDirDivider
    If you have tons of cache items a directory with thousands of entries will be slow to read. You can influence the max. count of possible files in a directory by splitting the filename.
    default: none (all cache files will be stored in one directory)

Copyright © 2009-2024 Axel Hahn
project page: GitHub (en)
Axels Webseite (de)
results will be here