mozfr/transvision — pull request #210 by pascalchevrel (2014-03-22 15:42:34+00:00)
Title: Issue #159 : caching system

* New Cache class with these methods:
- setKey()
- getKey()
- deleteKey()
- isValidKey()
- isObsoleteKey()
- getKeyPath()
- getCachePath()
- isActivated()
- flush()

* New constants:
- CACHE constant activates/deactivates the cache
- CACHE_TIME is the default duration of the cache
- CACHE_PATH is the path to the cache folder

There are also fallback constants in the class to use it outside of Transvision as a drop in class.

* GET['nocache'] to force a page not to use caching

* Cache duration
- can't be older than generated data (uses a timestamp file in glossaire.sh)
- can be defined in seconds when using getKey(), ex getKey($id, 300)

* Onestring model makes a use of the class, ex:

if (! $data = Cache::getKey($cache_id)) {
/* create $data */
/* Now cache data */
Cache::setKey($cache_id, $data);
}

* Tests for all methods