![]() |
|
skMySQLCachePlugin |
|
![]() |
1
user
Sign-in
to change your status |
This symfony plugin contains the MySQL cache adapter class.
Set the cache class to skMySQLCache in your factories.yml. You can either use an existing Doctrine MySQL connection configured in your databases.yml, or specify connection details.
The available parameters are as follows:
sfCachedatabase — Doctrine connection name as specified in your databases.ymldsn — PDO-compatible DSN stringusernamepasswordtable — Table name for the cache (defaults to cache)Example configuration:
view_cache:
class: skMySQLCache
param:
database: doctrine
table: viewcache
The following SQL will create the cache table, make sure to use the same table name you specified in your factories.yml above:
CREATE TABLE `cache` (
`key` varchar(255) NOT NULL DEFAULT '',
`data` longtext,
`timeout` bigint(20) unsigned NOT NULL,
`last_modified` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`key`),
KEY `key` (`key`,`timeout`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
We're using ints for the timestamps because, for what we need, they're faster than datetime or timestamp.
skMySQLCachePlugin by Studio Skylab
This code is released under the Creative Commons Attribution-ShareAlike 3.0 License.