wp-metacache/README.md

1.1 KiB

#wp-metacache

This is a combination wordpress plugin and Go service that replaces Wordpress' built in object metadata handling.

Wordpress has two types of object, posts and users. Both have metadata tables and are accessed through the same mechanisms.

Wordpress uses a greedy load system where loading a single metadata attribute will actually load all metadata for that object, and cache the other entries for the life of the request. This more or less works well on small sites where there may be a few or a dozen metadata attributes, but doesn't scale well as those numbers increase. At the same time, the lifespan of that cache is a single request.

This software uses Wordpress hooks to handle those metadata requests via an external Go process. In Go we implement a LRU cache to greedily load metadata but return it a single item at a time. The Go process will retain the data until we reach a configured max capacity, at which point the longest unused entry will be removed. We also hook into Wordpress metadata update and delete routines to explicitly remove entries when stale.

Communication with the Go process is via a Unix socket.