All Projects → szepeviktor → tiny-cache

szepeviktor / tiny-cache

Licence: other
Cache WordPress post content, template part, translations and nav menu output in persistent object cache

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to tiny-cache

WP-Performance
Speed optimization plugin for Wordpress
Stars: ✭ 22 (-15.38%)
Mutual labels:  wordpress-plugin, cache
Nginx Helper
Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
Stars: ✭ 170 (+553.85%)
Mutual labels:  wordpress-plugin, cache
Wp Rocket
Performance optimization plugin for WordPress
Stars: ✭ 394 (+1415.38%)
Mutual labels:  wordpress-plugin, cache
Redis Cache
A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Credis, HHVM, replication and clustering.
Stars: ✭ 205 (+688.46%)
Mutual labels:  wordpress-plugin, cache
Fragment Cache
WordPress plugin for partial and async caching.
Stars: ✭ 135 (+419.23%)
Mutual labels:  wordpress-plugin, cache
WP-Stash
Bridge between WordPress and StashPHP, providing a PSR6-compliant caching system for WordPress
Stars: ✭ 31 (+19.23%)
Mutual labels:  wordpress-plugin, cache
genesis-js-no-js
WordPress plugin for Genesis child themes. Adds a 'no-js' body class to the front-end, and a small inline script that changes it to `js` if JavaScript is enabled. Allows for styling of elements (like potential hiding) if JavaScript is enabled.
Stars: ✭ 21 (-19.23%)
Mutual labels:  wordpress-plugin
buoy
🆘 A community-based crisis response system. Because friends don't let friends call the cops. 🔥🚓🔥
Stars: ✭ 68 (+161.54%)
Mutual labels:  wordpress-plugin
wp-rest-api-filter-items
A WordPress plugin that filters WP REST API items to your requirement.
Stars: ✭ 61 (+134.62%)
Mutual labels:  wordpress-plugin
netlify-plugin-cache
⚡ Generic plugin for caching any files and/or folders between Netlify builds
Stars: ✭ 19 (-26.92%)
Mutual labels:  cache
wordpress-nodeinfo
NodeInfo and NodeInfo2 for WordPress
Stars: ✭ 13 (-50%)
Mutual labels:  wordpress-plugin
mediapress
The Most advanced Media Gallery Plugin for BuddyPress
Stars: ✭ 31 (+19.23%)
Mutual labels:  wordpress-plugin
debugpress
DebugPress is easy to use plugin implementing popup for debugging currently loaded WordPress page with support for intercepting AJAX requests.
Stars: ✭ 19 (-26.92%)
Mutual labels:  wordpress-plugin
chatterbox
Create chat threads using WordPress Blocks inside app and device wrappers.
Stars: ✭ 18 (-30.77%)
Mutual labels:  wordpress-plugin
AuthPress
Add 2-factor authentication to your WordPress blog site.
Stars: ✭ 16 (-38.46%)
Mutual labels:  wordpress-plugin
wp-tyk-dev-portal
A WordPress plugin that adds a developer portal for a Tyk API Gateway
Stars: ✭ 12 (-53.85%)
Mutual labels:  wordpress-plugin
falcon
A WordPress cleanup and performance optimization plugin.
Stars: ✭ 17 (-34.62%)
Mutual labels:  wordpress-plugin
perfecty-push-wp
WordPress plugin for self-hosted Web Push Notifications ⚡️
Stars: ✭ 32 (+23.08%)
Mutual labels:  wordpress-plugin
averroes
A Gutenberg compatible markdown editor. Write in Markdown, edit in Markdown and preview in HTML.
Stars: ✭ 15 (-42.31%)
Mutual labels:  wordpress-plugin
memoize
Caching library for asynchronous Python applications.
Stars: ✭ 53 (+103.85%)
Mutual labels:  cache

Tiny cache

Cache post content, translations and nav menu output in persistent object cache.

This MU plugin works well in production providing you understand its source code (133 sloc).

WordPress performance

How to achieve high performance in WordPress?

Item Tool Speedup
Infrastructure CPU, disk, web server, PHP (OPcache) and DNS Overall performance
In-memory object cache Redis, Memcached, APCu options, post, post meta etc.
Server-side functionality plugins
(backup, db cleanup)
Use WP-CLI instead Degrades performance
Theme and plugins Cache-aware ones using object cache or transients
Translations tiny-translation-cache .mo file parsing
Navigation menus tiny-nav-menu-cache wp_nav_menu()
Post content tiny-cache the_content()
Template output tiny-cache get_template_part()
Widgets widget-output-cache plugin dynamic_sidebar()

This list concentrates on WordPress core generating HTML code. Frontend loading (full page cache) is another topic.

Usage

Of course you need persistent object cache. Consider Redis server and wp-redis plugin.

Replace the_content() calls in your theme.

NOTICE Replace only argument-less calls! $more_link_text and $strip_teaser are not supported.

find -type f -name "*.php" | xargs -r -L 1 sed -i -e 's|\bthe_content();|the_content_cached();|g'

No-cache situations

  • wp_suspend_cache_addition( true );
  • define( 'DONOTCACHEPAGE', true );

Prevent missing plugin

Protection against plugin deactivation.

Copy these to your theme's functions.php.

    if ( ! function_exists( 'the_content_cached' ) ) {
        function the_content_cached( $more_link_text = null, $strip_teaser = false ) {
            the_content( $more_link_text, $strip_teaser );
        }
    }
    if ( ! function_exists( 'get_the_content_cached' ) ) {
        function get_the_content_cached( $more_link_text = null, $strip_teaser = false ) {
            return get_the_content( $more_link_text, $strip_teaser );
        }
    }
    if ( ! function_exists( 'get_template_part_cached' ) ) {
        function get_template_part_cached( $slug, $name = null, $version_hash = '' ) {
            get_template_part( $slug, $name );
        }
    }

Little sisters

  1. Tiny navigation menu cache - for nav menu output
  2. Tiny translation cache - for translations (.mo files)

Alternative

https://github.com/Rarst/fragment-cache

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].