Description:
This patch introduces caching for both nodes and users. While it will still help performance without using memcache, it is recommended that you enable the memcache module to cache this data in memory for optimal performance. Both tables can be manually flushed along with Drupal's standard caches by clicking the 'Clear cached data' button on the Performance administrator site configuration page.
Certain node types can not be cached as well as others. For example, the core 'poll' node type can display differently to each user viewing it, thus this patch provides a 'cache_node_anonymous_types' setting which lists the poll node type by default. Any node types listed in this setting will only be cached for anonymous users. You can add additional node types to this setting by defining 'cache_node_anonymous_types' in your settings.php configuration file.
Another setting, 'cache_node_exclude_types', can be used to completely exclude one or more nodes type from the node cache. This setting can also be defined in your settings.php configuration file.
There are no configuration options for the user cache. All logged in users are cached by this patch. Users are cached in the cache_user table and in a static variable. The anonymous user is not cached.
If using this patch with memcache, you will need to define the 'cache_node' and 'cache_user' bins. (Note that the 'cache_user' bin is different than the 'users' bin required if using memcache-session.inc.) Cached content in each bin is only flushed by a specific identifier, the entire table is never flushed (unless you do so manually), so these two cache tables can safely live in the same bin.
If using this patch with the database, you will need to define the 'cache_node' and 'cache_user' database tables.
For MySQL:
CREATE TABLE cache_node (
cid varchar(255) NOT NULL default '',
data longblob,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
serialized int(1) NOT NULL default '0',
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */;
CREATE TABLE cache_user (
cid varchar(255) NOT NULL default '',
data longblob,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
serialized int(1) NOT NULL default '0',
PRIMARY KEY (cid),
INDEX expire (expire)
) /*!40100 DEFAULT CHARACTER SET UTF8 */;
For PostgreSQL:
CREATE TABLE cache_node (
cid varchar(255) NOT NULL default '',
data bytea,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
serialized smallint NOT NULL default '0',
PRIMARY KEY (cid)
);
CREATE TABLE cache_user (
cid varchar(255) NOT NULL default '',
data bytea,
expire int NOT NULL default '0',
created int NOT NULL default '0',
headers text,
serialized smallint NOT NULL default '0',
PRIMARY KEY (cid)
);
Patch:
http://tag1consulting.com/patches#load_cache
Status:
This patch has not been merged into any release of Drupal.
Patch source:
Written by Tag1 Consulting, Inc.
Original patch sponsored by ParentsClick / Lifetime Digital
