I'm trying to use the Zend_Cache_Frontend_Function to cache an object's
method call and I keep receiving the exception 'Incorrect function name'.
This is due to the fact that I am trying to call a method of $this object.
The problem is that when using call_user_func_array you must pass the name
of the method as an array with the object a la
call_user_func_array(array($this, '_myMethod'), array($param1, $param2));
So when I tried to use the Zend_Cache_Frontend_Function it uses the name to
create the id for the cache file. Because of this it is expecting the name
to be a string wheras it is an array in my case. Here is how I am calling
it
if ($cacheEnabled) {
return $cache->call(array($this, '_myMethod'), array($param1, $param2));
}
return $this->_myMethod($param1, $param2);
commenting lines 134-136 in Zend/Cache/Frontend/Function.php allows my code
to work.
Isn't there a better approach to making the Id than restricting the name to
being a string? Or is there some other way to handle this? I'm actually
somewhat surprised that no-one has ran into this or maybe my search wasn't
exhaustive enough? I didn't find anything in the issue tracker or on here
that seemed to be the same issue.
Thanks,
-Joshua-