diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/classes/cache/Cache_interface.php | 5 | ||||
| -rw-r--r-- | core/classes/cache/FileCache.php | 24 |
2 files changed, 19 insertions, 10 deletions
diff --git a/core/classes/cache/Cache_interface.php b/core/classes/cache/Cache_interface.php index 7c49789..1c96f5a 100644 --- a/core/classes/cache/Cache_interface.php +++ b/core/classes/cache/Cache_interface.php @@ -1,9 +1,12 @@ <?php /** Cache interface - * --- + * ----------------------------------------------------------------------------- + * * Interface to save results of expensive data-extraction proccess, * in a fast-accessed medium (ussually RAM or NVME SSD units) + * + * ----------------------------------------------------------------------------- */ interface Cache_interface { diff --git a/core/classes/cache/FileCache.php b/core/classes/cache/FileCache.php index fb7eee5..fe4a4e4 100644 --- a/core/classes/cache/FileCache.php +++ b/core/classes/cache/FileCache.php @@ -1,20 +1,26 @@ <?php /* FileCache - * --- + * ----------------------------------------------------------------------------- + * * Saves serialized data into filesystem. - * Use it for expensive database-queries. - * Performanve on a NVMe-SSD drive is really great; - * (even better than MemCached and Redis) - * performance on a typical HDD is just fair. + * + * Use it for repetitive expensive database-queries + * or other common time/source-consuming tasks + * + * Performance on a local NVMe-SSD drive can be great; + * Performance on a typical HDD is just fair. * * NOTE: * Memcached and Redis are much faster cache-technologies - * and generally recommended; but they are not always available; + * (when implemented locally) but not always available; * FileCache is (almost) always available; * - * Before tou decide on your caching technology - * run some benchmarks. + * RECOMMENDATION: + * Before you decide on your actual caching technology + * design and run a few comparative benchmarks + * + * ----------------------------------------------------------------------------- */ class FileCache implements Cache_interface { @@ -28,7 +34,7 @@ class FileCache implements Cache_interface { // filename is a hashed 48-hex-digit string // probability of collision = exp( (-k*(k-1)) / 2N ) - // ex: for 10tril.samples P(collision) = 1.5E-11% + // example case: for 10tril.samples P(collision) = 1.5E-11 $filename = FILECACHE_PATH . sha1($key); // Opening file for write |
