Skip to content

studioskylab/skMySQLCachePlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

skMySQLCachePlugin

This symfony plugin contains the MySQL cache adapter class.

Configuration

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:

  • All parameters available to sfCache
  • When using a Doctrine connection:
    • database — Doctrine connection name as specified in your databases.yml
  • When specifying connection details:
    • dsn — PDO-compatible DSN string
    • username
    • password
  • table — Table name for the cache (defaults to cache)

Example configuration:

view_cache:
  class:        skMySQLCache
  param:
    database:   doctrine
    table:      viewcache

Database Setup

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.

License and Attribution

skMySQLCachePlugin by Studio Skylab

This code is released under the Creative Commons Attribution-ShareAlike 3.0 License.

About

Symfony 1.4 plugin implementing MySQL-based caching

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published