diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-17 03:27:03 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-17 03:27:03 +0300 |
| commit | c870b0f4bb688d58575c700f523972bd5cf1be55 (patch) | |
| tree | 0866cc8b7c6b48d0c8cb436b2148a44f7472383b /core/classes/cache | |
| parent | b49941608a8d37ca6bedf2529a703876530124d4 (diff) | |
| download | gyraf1gov-c870b0f4bb688d58575c700f523972bd5cf1be55.tar.gz gyraf1gov-c870b0f4bb688d58575c700f523972bd5cf1be55.tar.bz2 gyraf1gov-c870b0f4bb688d58575c700f523972bd5cf1be55.zip | |
initializing framework refactoring completed
Diffstat (limited to 'core/classes/cache')
| -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 |
