|
|||
|
I've tried to make an implementation of Zend_Db_Adapter_Mysqli that adds a two parameters: bool cache, and int ttl. To specify whether to use caching, and if so how long the cache has to live.
The reason for this implementation is that I want to make it easier to cache database queries. Code: PHP Code:
Saving to the cache works fine, but when I reload the page I get this error: Quote:
Thanks in advance. |
|
|||
|
Months later, I wanted to add to this (moreso for newbies like me than anyone else). I wanted to start using Zend_Cache and kept getting the same errors as fiskah had. This was the only search result that even discussed it.
I believe the issue is that we were attempting to cache a Zend_Db_Statement_Mysqli object, which was the returned result from (something similary to) $db->query($query);. Unfortunately, when grabbed from the cache, you no longer have access to its methods, such as fetch(), so you get an error. For me, the solution is to use fetchAll() instead of query(). fetchAll() returns a simple array, which can be accessed from the cache using a foreach loop. If I stated anything wrong, please correct me. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|