-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed
Labels
status:to be verifiedNeeds to be reproduced and validated.Needs to be reproduced and validated.type:bugBugBug
Milestone
Description
Create table for PostgreSQL
create table "settings"
(
"id" varchar(128) not null,
"data" BLOB,
primary key ("id")
);
INSERT INTO "public"."settings" VALUES ('6a3ce1a0bffe8eeb6fa986caf443e24c', 'a:1:{s:13:"template";s:1:"1";}');Cache Query
$result = Yii::$app->db->cache(function($db) use ($key){
return (new Query())
->select(['data'])
->from('settings')
->where(['id' => $key])
->createCommand($db)
->queryScalar();
});
// First run return
var_export($result); // 'a:1:{s:13:"template";s:1:"1";}'
// After the request has been cached return
var_export($result); // 0This version of the caching works fine
protected function getValue($key)
{
$cache = Yii::$app->cache;
$result = $cache->get($key);
if ($result === false) {
$result = (new Query())
->select(['data'])
->from('settings')
->where(['id' => $key])
->createCommand()
->queryScalar();
$cache->set($key, $result);
}
return $result;
}Perhaps this bug will be in other database with BLOB data type
Metadata
Metadata
Assignees
Labels
status:to be verifiedNeeds to be reproduced and validated.Needs to be reproduced and validated.type:bugBugBug