Привет,
Использую кеширование схемы БД (и не только), вот мой /config/main.php:
'cache' => array(
'class' => 'system.caching.CDbCache',
'cacheTableName' => 'cache',
'connectionID' => 'db',
//'autoCreateCacheTable' => true,
),
'db' => array(
'connectionString' => 'mysql:host=***;dbname=***',
'username' => '****',
'password' => '***',
'charset' => 'utf8',
'schemaCachingDuration' => 3600,
'enableParamLogging' => true,
'enableProfiling' => true,
'emulatePrepare' => true,
),
Иногда (раз в месяц) на продакшне возникает ошибка:
[spoiler]2012/11/23 01:26:02 [error] [system.db.CDbCommand]
CDbCommand::execute() failed: SQLSTATE[23000]: Integrity constraint
violation: 1062 Duplicate entry ‘6e0f86ff6b54d1726dabc69930f49461’ for
key 1. The SQL statement executed was: INSERT INTO cache
(id,expire,value) VALUES
(‘6e0f86ff6b54d1726dabc69930f49461’,1353666362,:value). Bound with
:value=‘a:2:{i:0;O:17:“CMysqlTableSchema”:9:{s:10:“schemaName”;N;s:4:“name”;s:7:“setting”;s:7:“rawName”;s:9:"setting
";s:10:“primaryKey”;s:3:“key”;s:12:“sequenceName”;N;s:11:“foreignKeys”;a:0:{}s:7:“columns”;a:2:{s:3:“key”;O:18:“CMysqlColumnSchema”:14:{s:4:“name”;s:3:“key”;s:7:“rawName”;s:5:"key
";s:9:“allowNull”;b:0;s:6:“dbType”;s:11:“varchar(20)”;s:4:“type”;s:6:“string”;s:12:“defaultValue”;N;s:4:“size”;i:20;s:9:“precision”;i:20;s:5:“scale”;N;s:12:“isPrimaryKey”;b:1;s:12:“isForeignKey”;b:0;s:13:“autoIncrement”;b:0;s:14:"’
. “\0” . ‘CComponent’ . “\0” . ‘_e";N;s:14:"’ . “\0” . ‘CComponent’ .
"\0" .
‘_m";N;}s:5:“value”;O:18:“CMysqlColumnSchema”:14:{s:4:“name”;s:5:“value”;s:7:“rawName”;s:7:"value
";s:9:“allowNull”;b:1;s:6:“dbType”;s:12:“varchar(250)”;s:4:“type”;s:6:“string”;s:12:“defaultValue”;N;s:4:“size”;i:250;s:9:“precision”;i:250;s:5:“scale”;N;s:12:“isPrimaryKey”;b:0;s:12:“isForeignKey”;b:0;s:13:“autoIncrement”;b:0;s:14:"’
. “\0” . ‘CComponent’ . “\0” . ‘_e";N;s:14:"’ . “\0” . ‘CComponent’ .
“\0” . ‘_m";N;}}s:14:"’ . “\0” . ‘CComponent’ . “\0” . ‘_e";N;s:14:"’
. “\0” . ‘CComponent’ . “\0” . ‘_m";N;}i:1;N;}’.[/spoiler]
Таблица cache:
[sql]CREATE TABLE cache
(
`id` CHAR(128) NOT NULL,
`expire` INT(11) NULL DEFAULT NULL,
`value` LONGBLOB NULL,
PRIMARY KEY (`id`)
)
COLLATE=‘latin1_swedish_ci’
ENGINE=MyISAM;[/sql]
PHP 5.3.18, yii 1.1.12, MySQL 5.0.77
Подскажите, в чем причина ошибки.