Skip to content
This repository was archived by the owner on Mar 20, 2020. It is now read-only.

FusedInteractive/Wordpress-Cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Simple Wordpress Cache

If you have parts of your Wordpress theme that run slow it may work to cache them. Automatically creates refresh records in a database table so you can create caches dynamically.

Created by Fused Interactive

Our Website | Follow us on Twitter | Like us on Facebook

Installation

Run the following SQL query on your Wordpress database:

CREATE TABLE `cache` (
	  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
	  `name` varchar(100) NOT NULL DEFAULT '',
	  `lastrun` varchar(100) DEFAULT NULL,
	  `runevery_min` int(11) NOT NULL DEFAULT '30',
	  `runevery_hour` int(11) NOT NULL DEFAULT '0',
	  `runevery_day` int(11) NOT NULL DEFAULT '0',
	  PRIMARY KEY (`id`)
);

Upload the cache.php file to either your theme folder or a sub-directory in your theme folder.

Make sure to CHMOD the files directory to 777.

Usage

Make sure you include the cache.php file and create the class. We recommend doing this in functions.php.

require_once 'cache.php';
$cache = new Simple_WP_Cache();

You can either add your caches to the database manually so you can specify a refresh period (minutes, hours, or days) or the class will do it automatically and set them to refresh every 30 minutes. (Note: If you want them to for sure refresh every 30 minutes you'll need to setup a cron job. No documentation from us for that, so good luck.)

Example

if(!$mydata = $cache->load('mydata')) {
		$mydata = array('a', 'b', 'c');
		$cache->build('mydata', $mydata);
}

About

Simple cache for use in your Wordpress themes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages