Follow Phalcon Official document go to the Model force cache, an old error occurred: Cache didn ' t return a valid resultset.
The exact meaning is that the cache does not return a valid result set.
Modelscache as follows:
/**
* @return Redis
*/
Public Function Getmodelcache ()
{
$frontend = new Json ([
"Lifetime" = $this->config->model->lifetime,
]);
return new Redis ($frontend, [
"Host" = $this->config->model->host,
"Port" = $this->config->model->port,
"Persistent" = False,
"Statskey" = $this->keyslistname,
"Index" = $this->config->model->database,
]);
}
Look at the source code on GitHub:
Let cache = this->_dependencyinjector->getshared (cacheservice);
If typeof Cache! = "Object" {
throw new Exception ("Cache service must is an object");
}
Let result = Cache->get (key, Lifetime);
If result!== null {
If typeof result! = "Object" {
throw new Exception ("Cache didn ' t return a valid resultset");
}
Result->setisfresh (FALSE);
......
This exception is thrown when the result returned by the cache is not an object, and it is worth noting that the data returned after processing using cryptographic classes such as Json,base64 has lost the original class information. So there will be an error. Therefore, it is possible to use the data class that comes with it to encrypt and decrypt it. The encryption and decryption used by the data class are PHP serialize and unserialize. The original data information is not lost.
Models forcing cache (model forced caching) in Phalcon pits