{"id":13534698,"url":"https://github.com/szepeviktor/tiny-cache","last_synced_at":"2025-04-23T03:22:20.556Z","repository":{"id":22227697,"uuid":"95655517","full_name":"szepeviktor/tiny-cache","owner":"szepeviktor","description":"🚄 Cache WordPress post content, template part, translations and nav menu output in persistent object cache","archived":false,"fork":false,"pushed_at":"2022-12-21T19:09:36.000Z","size":26,"stargazers_count":27,"open_issues_count":2,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T21:32:20.009Z","etag":null,"topics":["cache","object-cache","performance","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://github.com/szepeviktor/wordpress-website-lifecycle/blob/master/WordPress-performance.md","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szepeviktor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-28T10:03:45.000Z","updated_at":"2024-08-28T14:48:58.000Z","dependencies_parsed_at":"2023-01-11T21:32:15.224Z","dependency_job_id":null,"html_url":"https://github.com/szepeviktor/tiny-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Ftiny-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Ftiny-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Ftiny-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Ftiny-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szepeviktor","download_url":"https://codeload.github.com/szepeviktor/tiny-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250361456,"owners_count":21417890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","object-cache","performance","wordpress-plugin"],"created_at":"2024-08-01T08:00:36.469Z","updated_at":"2025-04-23T03:22:20.512Z","avatar_url":"https://github.com/szepeviktor.png","language":"PHP","funding_links":[],"categories":["Object Caching Plugins"],"sub_categories":[],"readme":"# Tiny cache\n\nCache post content, translations and nav menu output in persistent object cache.\n\nThis MU plugin works well in **production** providing you understand its source code (133 sloc).\n\n### WordPress performance\n\nPlease see https://github.com/szepeviktor/wordpress-website-lifecycle/blob/master/WordPress-performance.md\n\n### Usage\n\nOf course you need **persistent** object cache. Consider Redis server and `wp-redis` plugin.\n\nReplace `the_content()` calls in your theme.\n\n**NOTICE** Replace only argument-less calls! `$more_link_text` and `$strip_teaser` are not supported.\n\n```bash\nfind -type f -name \"*.php\" | xargs -r -L 1 sed -i -e 's|\\bthe_content();|the_content_cached();|g'\n```\n\n### No-cache situations\n\n- `wp_suspend_cache_addition( true );`\n- `define( 'DONOTCACHEPAGE', true );`\n\n### Prevent missing plugin\n\nProtection against plugin deactivation.\n\nCopy these to your theme's functions.php.\n\n```php\n    if ( ! function_exists( 'the_content_cached' ) ) {\n        function the_content_cached( $more_link_text = null, $strip_teaser = false ) {\n            the_content( $more_link_text, $strip_teaser );\n        }\n    }\n    if ( ! function_exists( 'get_the_content_cached' ) ) {\n        function get_the_content_cached( $more_link_text = null, $strip_teaser = false ) {\n            return get_the_content( $more_link_text, $strip_teaser );\n        }\n    }\n    if ( ! function_exists( 'get_template_part_cached' ) ) {\n        function get_template_part_cached( $slug, $name = null, $version_hash = '' ) {\n            get_template_part( $slug, $name );\n        }\n    }\n```\n\n## Little sisters\n\n1. Tiny **navigation menu** cache - for nav menu output\n1. Tiny **translation** cache - for translations (.mo files)\n\n## Alternative\n\nhttps://github.com/Rarst/fragment-cache\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszepeviktor%2Ftiny-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszepeviktor%2Ftiny-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszepeviktor%2Ftiny-cache/lists"}