Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

Chapter 1. EXT: Plugin cache engine

Extension Key: enetcache

Language: en

Keywords: plugin cache, caching framework, forDevelopers, forAdvanced

Copyright 2009-2009, Christian Kuhn, <lolli@schwarzbu.ch>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

1.1. Introduction

Target audience

This extension is intended for developers who need a caching solution in TYPO3 for dynamic high traffic sites. This manual focuses on implementing enetcache in your own extensions. Hints are given about proper tagging and identifier building that need to be taken into consideration to receive a working implementation. It also explains how a wrapper to existing plugins could look like, would you wish to implement this caching solution for the caching of plugin content elements, all without changing much code of the wrapped extension. This manual tries to be as descriptive as possible and explains all problems and pitfalls you have to think about if you decide to use enetcache.

What does it do?

This extension provides an API for frontend plugins to realize caching on a plugin element level. It's based on the new caching framework included in TYPO3 4.3. This extension fills a gap between USER and USER_INT plugins by enabling plugins to cache their own content for a given lifetime and using this cache entry to save the computing resources if other parts of the page have to be re-rendered.

This is especially useful if pages have elements that need to be re-rendered often (like “mostclicked hotlists”) while other elements on the page have a much longer lifetime and therefore clog the processor unnecessarily, when rendered over and over again along with the other elements. Especially with highly dynamic, heavy traffic pages this kills dearly needed server resources unnecessarily, slowing down vital performance.

enetcache implements a mostly automatic clearing of cache elements if records are changed in the backend. If correctly implemented, editors will not even recognize that this extension is in use and will never need to manually clear caches.

Features

  1. API for frontend plugins to easily get, set and drop entries in the cache engine. The usual TYPO3 page cache is handled transparently by enetcache.

  2. Flexible lifetime handling of cache entries.

  3. Cached plugin content can be re-used on different pages.

  4. Automagic clearing of dirty cache entries if records have been changed in the backend.

  5. Hooks into “Clear all cache” to enable administrators to manually clear content element caches together with the regular page cache.

  6. Provides a scheduler task to do a garbage collection of old entries for cache backends that don't do that automatically (like dbBackend).

  7. Hooks in it's main frontend class allow other extensions to manipulate the cache handling. This is used by ext:enetcacheanalytics which comes with a fine grained backend module for debugging and tracking cache actions.

  8. Provides transparent cache wrappers for some widely used extensions. Currently wec_map and vge_tagcloud are supported.

  9. Provides a new database cache backend which stores compressed html content to save space and to speed up big cache tables.

See also

  1. Ext:enetcacheanalytics is a second extension which is an important tool to see what is going on in the engine. It's currently not developed as far as enetcache, and needs a code cleanup and documentation. You can find it in forge.

  2. enetcache is pretty well documented inline. Please take a look to the source.

Thanks

This extension was developed by Michael Knabe and Christian Kuhn for e-netconsulting KG in Hamburg. Thanks to e-netconsulting for giving us enough time to develop a clean and releasable version.