ryxeo-glpi-git / lib / cache_lite / docs / technical @ b67d8923
Historique | Voir | Annoter | Télécharger (1,34 ko)
1 | b67d8923 | Eric Seigne | Technical choices for Cache_Lite... |
---|---|---|---|
2 | ----------------------------------- |
||
3 | |||
4 | To begin, the main goals of Cache_Lite : |
||
5 | - performances |
||
6 | - safe use (even on very high traffic or with NFS (file locking doesn't work |
||
7 | with NFS)) |
||
8 | - flexibility (can be used by the end user or as a part of a larger script) |
||
9 | |||
10 | |||
11 | For speed reasons, it has been decided to focus on the file container (the |
||
12 | faster one). So, cache is only stored in files. The class is optimized for that. |
||
13 | If you want to use a different cache container, have a look to PEAR/Cache. |
||
14 | |||
15 | For speed reasons too, the class 'Cache_Lite' has do be independant (so no |
||
16 | 'require_once' at all in 'Cache_Lite.php'). But, a conditional include_once |
||
17 | is allowed. For example, when an error is detected, the class include dynamicaly |
||
18 | the PEAR base class 'PEAR.php' to be able to use PEAR::raiseError(). But, in |
||
19 | most cases, PEAR.php isn't included. |
||
20 | |||
21 | For the second goal (safe use), there is three (optional) mecanisms : |
||
22 | - File Locking : seems to work fine (but not with distributed file system |
||
23 | like NFS...) |
||
24 | - WriteControl : the cache is read and compared just after being stored |
||
25 | (efficient but not perfect) |
||
26 | - ReadControl : a control key (crc32(), md5() ou strlen()) is embeded is the |
||
27 | cache file and compared just after reading (the most efficient |
||
28 | but the slowest) |