[TYPO3-mvc] blog_example - caching issues?
Robert Lemke
robert at typo3.org
Wed May 20 14:22:15 CEST 2009
Steffen Kamper schrieb:
> i also think this magic is too complex, you never will cover all cases.
> Ext author should decide when to flush the cache imho.
Well, maybe.
Just another thought which popped up while reading this thread: How
about introducing a mechanism which allows you to cache a method call.
Cache entries would be generated depending on the argument values of
that method.
Example (FLOW3 style):
/**
* @param SomeClass $someObject
* @return string
*/
public function showAction(SomeClass $someObject) {
$data = $this->getSomeExpensiveData($someObject, 'xy');
...
}
/**
* ...
* @cacheable
*/
protected function getSomeExpensiveData($someObject, $someOtherArgument) {
return 'something';
}
By that some sub-operations could be cached.
However, what's not solve of course is: How / when is the cache flushed?
How does the controller know that its output can be cached alltogether?
I guess that the most realistic way to handle this is to let the user
define if an action can be cached (with @cacheable) and provide for some
way to flush the cache again:
public function initializeAction() {
if (foo()) {
$this->flushActionCache('show');
}
}
Anyway, I haven't put too much thought into that yet, so feel free to
come up with a better way ...
Cheers,
robert
More information about the TYPO3-project-typo3v4mvc
mailing list