[FEATURE] Add hook to t3lib_cache_frontend_VariableFrontend->set()
authorFabrizio Branca <mail@fabrizio-branca.de>
Thu, 1 Mar 2012 23:42:12 +0000 (00:42 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Tue, 13 Mar 2012 08:54:12 +0000 (09:54 +0100)
A hook is needed that is processed when storing something
into the cache.

This hook could be used to reuse the page tags in some external caches
like nc_staticfilecache or even varnish. In combination with the
hook introduced in #34475 external caches could easily be synced
to the TYPO3 page cache.

Change-Id: I0452b937c48ec5ab4e4147995da600bf9815f20a
Resolves: #34476
Releases: 4.8
Reviewed-on: http://review.typo3.org/9328
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php

index 03bb475..21774c2 100644 (file)
@@ -82,6 +82,18 @@ class t3lib_cache_frontend_VariableFrontend extends t3lib_cache_frontend_Abstrac
                        }
                }
 
                        }
                }
 
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php']['set'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php']['set'] as $_funcRef) {
+                               $params = array(
+                                       'entryIdentifier' => &$entryIdentifier,
+                                       'variable' => &$variable,
+                                       'tags' => &$tags,
+                                       'lifetime' => &$lifetime
+                               );
+                               t3lib_div::callUserFunction($_funcRef, $params, $this);
+                       }
+               }
+
                if ($this->useIgBinary === TRUE) {
                        $this->backend->set($entryIdentifier, igbinary_serialize($variable), $tags, $lifetime);
                } else {
                if ($this->useIgBinary === TRUE) {
                        $this->backend->set($entryIdentifier, igbinary_serialize($variable), $tags, $lifetime);
                } else {