所以我们一直在修改我们的应用程序以使用Redis来缓存我们的ORM(自定义构建)的一些结果,到目前为止它似乎工作得很好,直到我们遇到它总是崩溃我们给我们回来“RedisException:Redis服务器消失了”哦,因为有太多信息可以使用:)
我们一直在浏览日志(docker和verbose redis.log),以了解发生的事情无济于事。我们所知道的:
我们这里的选项实际上已经用完了,这里有一些更多的信息,比如代码,这样你就可以知道发生了什么,有些帮助会在这一点上受到赞赏:
更多信息
Docker architecture
PHP7.0 latest build
Redis latest build from official repo on docker
RedisCache.php
/**
* Standard Redis object coming from php-redis extension
* @var \Redis
*/
protected $redis;
public function offsetExists($offset)
{
try {
return $this->redis->exists($offset); //<-- Fails here
} catch (\RedisException $ex) {
return false;
}
}
public function offsetSet($offset, $value)
{
$this->redis->set($offset, serialize($value)); //<-- Fails here
$this->redis->expire($offset, 60 * 60);
}
client.api.php
public static function getCachedRecords(
$endPoint,
$data = [],
$asArray = false,
\LearningBird\Cache\BaseCache $cache
) {
$key = 'api:' . md5(($asArray ? 'asArray' : '') . ':' . serialize([$endPoint, $data]));
try {
$data = $cache[$key];
} catch (\Exceptions\Data\NotFoundException $ex) {
$cache[$key] = $data = self::getRecords($endPoint, $data, $asArray);
}
return $data;
}
**编辑#1 - Stacktrace +有效的键的例子**
Array
(
[0] => Array
(
[file] => /var/www/Classes/LearningBird/Cache/RedisCache.php
[line] => 64
[function] => get
[class] => Redis
[type] => ->
[args] => Array
(
[0] => api:4a23b037c2ff882924db6974a665b12a
)
)
[1] => Array
(
[file] => /var/www/feather/dataExchange/api.learningbird.com/client.api.php
[line] => 262
[function] => offsetGet
[class] => LearningBird\Cache\RedisCache
[type] => ->
[args] => Array
(
[0] => api:4a23b037c2ff882924db6974a665b12a
)
)
[2] => Array
(
[file] => /var/www/feather/classes/mvc/models/topicsRecord.php
[line] => 167
[function] => getCachedRecords
[class] => apiClient
[type] => ::
[args] => Array
(
[0] => /topics/getParentSuperTopics/4196
[1] => Array
(
)
[2] =>
[3] => LearningBird\Cache\RedisCache Object
(
[redis:protected] => Redis Object
(
[socket] => 0
)
)
)
)
[3] => Array
(
[file] => /var/www/feather/classes/mvc/models/topicsRecord.php
[line] => 177
[function] => getParentSuperTopics
[class] => topicsRecord
[type] => ->
[args] => Array
(
)
)
[4] => Array
(
[file] => /var/www/Classes/LearningBird/Database/Provider/LessonProvider.php
[line] => 282
[function] => hasParentSuperTopics
[class] => topicsRecord
[type] => ->
[args] => Array
(
)
)
[5] => Array
(
[file] => /var/www/Classes/LearningBird/Database/Provider/LessonProvider.php
[line] => 158
[function] => getTopicsWithSuperTopics
[class] => LearningBird\Database\Provider\LessonProvider
[type] => ->
[args] => Array
(
[0] => recordSet Object
(
/** hidden, too large **/
)
)
)
[6] => Array
(
[file] => /var/www/Classes/LearningBird/Database/Provider/LessonProvider.php
[line] => 86
[function] => LearningBird\Database\Provider\{closure}
[class] => LearningBird\Database\Provider\LessonProvider
[type] => ->
[args] => Array
(
[0] => recordSet Object
(
/** hidden, too large **/
)
)
)
[7] => Array
(
[file] => /var/www/Classes/LearningBird/Database/Provider/LessonProvider.php
[line] => 191
[function] => getLessonsFromFilters
[class] => LearningBird\Database\Provider\LessonProvider
[type] => ->
[args] => Array
(
[0] => Array
(
[0] => LearningBird\Database\Provider\LessonProviderFilter Object
(
[type:protected] => lesson
[id:protected] => 20386
)
)
[1] => recordSet Object
(
/** hidden, too large **/
)
[2] => Closure Object
(
/** hidden, too large **/
)
[3] =>
[4] => Array
(
/** hidden, too large **/
)
[5] => Array
(
[0] => and
[1] => or
[2] => or
)
)
)
[8] => Array
(
[file] => /var/www/Classes/LearningBird/Database/Provider/STDAProvider.php
[line] => 82
[function] => getSTDALessons
[class] => LearningBird\Database\Provider\LessonProvider
[type] => ->
[args] => Array
(
[0] => Array
(
[0] => LearningBird\Database\Provider\LessonProviderFilter Object
(
[type:protected] => lesson
[id:protected] => 20386
)
)
[1] => topicLessonsRecordSet Object
(
/** hidden, too large **/
)
[2] => differentiationsRecordSet Object
(
[records:protected] => Array
(
/** hidden, too large **/
)
)
)
)
[9] => Array
(
[file] => /var/www/Classes/LearningBird/Database/Provider/STDAProvider.php
[line] => 44
[function] => getAllSTDAs
[class] => LearningBird\Database\Provider\STDAProvider
[type] => ->
[args] => Array
(
/** hidden, too large **/
)
)
[10] => Array
(
[file] => /var/www/app/application/components/lessons/component.php
[line] => 227
[function] => getSTDAs
[class] => LearningBird\Database\Provider\STDAProvider
[type] => ->
[args] => Array
(
** hidden, too large **/
)
)
[11] => Array
(
[function] => watch
[class] => lessonsController
[type] => ->
[args] => Array
(
[0] => dlvi1mywqv6c6sh0
)
)
[12] => Array
(
[file] => /var/www/feather/classes/mvc/baseController.php
[line] => 221
[function] => invokeArgs
[class] => ReflectionMethod
[type] => ->
[args] => Array
(
** hidden, too large **/
)
)
[13] => Array
(
[file] => /var/www/feather/classes/mvc/baseController.php
[line] => 105
[function] => exec
[class] => baseController
[type] => ->
[args] => Array
(
)
)
[14] => Array
(
[file] => /var/www/feather/classes/mvc/baseController.php
[line] => 89
[function] => _run
[class] => baseController
[type] => ->
[args] => Array
(
)
)
[15] => Array
(
[file] => /var/www/feather/classes/component/core.component.php
[line] => 43
[function] => run
[class] => baseController
[type] => ::
[args] => Array
(
)
)
[16] => Array
(
[file] => /var/www/app/application/webroot/index.php
[line] => 170
[function] => run
[class] => component
[type] => ::
[args] => Array
(
[0] => lessons
)
)
)
按照相同原则工作的密钥示例
topicsModel:a:1:{s:5:"where";s:39:"a:1:{s:7:"topicID";s:11:"s:4:"1599";";}";}
gradesModel:a:2:{s:9:"innerJoin";s:7:"s:0:"";";s:5:"where";s:95:"a:1:{s:10:"gradeLevel";s:63:"a:3:{i:0;s:8:"s:1:"9";";i:1;s:8:"s:1:"9";";i:2;s:8:"s:1:"9";";}";}";}
topicsModel:a:2:{s:9:"innerJoin";s:20:"s:12:"topicLessons";";s:5:"where";s:98:"a:2:{s:20:"topicLessons.deleted";s:8:"s:1:"0";";s:21:"topicLessons.lessonID";s:12:"s:5:"20386";";}";}
topicsModel:a:1:{s:5:"where";s:39:"a:1:{s:7:"topicID";s:11:"s:4:"4196";";}";}
languagesModel:a:1:{s:5:"where";s:37:"a:1:{s:9:"statusID!";s:8:"s:1:"0";";}";}
topicsModel:a:1:{s:5:"where";s:39:"a:1:{s:7:"topicID";s:11:"s:4:"2718";";}";}
differentiationsModel:a:2:{s:9:"innerJoin";s:30:"s:22:"lessonDifferentiations";";s:5:"where";s:65:"a:1:{s:31:"lessonDifferentiations.lessonID";s:12:"s:5:"20386";";}";}
regionsModel:a:1:{s:5:"where";s:66:"a:2:{s:9:"countryID";s:7:"s:0:"";";s:7:"stateID";s:9:"s:2:"79";";}";}
topicsModel:a:2:{s:9:"innerJoin";s:7:"s:0:"";";s:5:"where";s:103:"a:1:{s:7:"topicID";s:75:"a:3:{i:0;s:11:"s:4:"3361";";i:1;s:11:"s:4:"1523";";i:2;s:11:"s:4:"2115";";}";}";}
topicsModel:a:1:{s:5:"where";s:40:"a:1:{s:7:"topicID";s:12:"s:5:"11270";";}";}
topicsModel:a:1:{s:5:"where";s:39:"a:1:{s:7:"topicID";s:11:"s:4:"1523";";}";}
topicsModel:a:1:{s:5:"where";s:39:"a:1:{s:7:"topicID";s:11:"s:4:"3361";";}";}
api:b1eb15940ff2c1caca5e51239580c924
topicsModel:a:1:{s:5:"where";s:36:"a:1:{s:4:"slug";s:11:"s:4:"math";";}";}
topicsModel:a:1:{s:5:"where";s:39:"a:1:{s:7:"topicID";s:11:"s:4:"3205";";}";}
differentiationsModel:a:0:{}
stateSchoolStructuresModel:a:1:{s:5:"where";s:36:"a:1:{s:7:"stateID";s:9:"s:2:"79";";}";}
api:5135098ff6e115ec160bb9d552ac9442
statesModel:a:1:{s:5:"where";s:36:"a:1:{s:7:"stateID";s:9:"s:2:"79";";}";}
languagesModel:a:1:{s:5:"where";s:39:"a:1:{s:10:"languageID";s:8:"s:1:"1";";}";}
api:e532b1617c11604e6f5e241fffcc0e27
**不起作用的键(相同键,md5'或自然键)**
api::a:2:{i:0;s:33:"/topics/getParentSuperTopics/4196";i:1;a:0:{}}
4a23b037c2ff882924db6974a665b12a