+1 571-297-6383 | info@sonjara.com

Chapter 10. Miscellaneous Framework Features

Support for Caching Engines

The Fakoli framework provides support for a number of different PHP caching engines with a common interface that enables you to optimize your web application's data caching strategy without worrying about the underlying implementation. Fakoli provides support for APC (the Alternative PHP Cache) under Linux and Wincache under Windows. If neither of these options is present Fakoli will revert to using a file-backed cache that provides the same caching behavior at the cost of slightly worse performance.

Caching is handled through the Cache object. This object provides several methods for accessing cached data:

Cache::put(key, value)

This method stores an object in the application cache.


This method retrieves an object from the application cache. If there is no matching object then null is returned.


This method invalidates the given key, discarding the data from the cache.


This methods clears all values from the cache.

Marking DataItems as Cacheable

In addition to the caching primitives described above, Fakoli also provides the ability to mark your DataItem classes as cacheable to increase performance. This can be useful for DataItems that map data that does not often change and that is used frequently. To mark your DataItems and cacheable, just add the following line to your class definition:

    var $cacheLocal = true;

« Chapter 9. User Interface Components