{"id":13534699,"url":"https://github.com/Rarst/fragment-cache","last_synced_at":"2025-04-02T00:30:32.206Z","repository":{"id":15289981,"uuid":"18019561","full_name":"Rarst/fragment-cache","owner":"Rarst","description":"WordPress plugin for partial and async caching.","archived":false,"fork":false,"pushed_at":"2017-10-12T14:05:12.000Z","size":40,"stargazers_count":140,"open_issues_count":0,"forks_count":9,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-24T04:30:59.504Z","etag":null,"topics":["cache","performance","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rarst.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-22T20:53:13.000Z","updated_at":"2025-01-28T18:48:08.000Z","dependencies_parsed_at":"2022-08-25T14:40:37.953Z","dependency_job_id":null,"html_url":"https://github.com/Rarst/fragment-cache","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Ffragment-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Ffragment-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Ffragment-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rarst%2Ffragment-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rarst","download_url":"https://codeload.github.com/Rarst/fragment-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246734817,"owners_count":20825210,"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","performance","wordpress","wordpress-plugin"],"created_at":"2024-08-01T08:00:36.501Z","updated_at":"2025-04-02T00:30:31.904Z","avatar_url":"https://github.com/Rarst.png","language":"PHP","funding_links":[],"categories":["Fragment Caching Plugins"],"sub_categories":[],"readme":"# Fragment Cache\r\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Rarst/fragment-cache/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Rarst/fragment-cache/?branch=master)\r\n\r\nFragment Cache is a WordPress plugin for partial and async caching of heavy front-end elements. It currently supports caching navigation menus, widgets, and galleries.\r\n\r\nCaching is built on top of transients API (with enhancements provided by TLC Transients library), provides soft expiration and transparent object cache support.\r\n\r\n# Installation\r\n\r\nDownload plugin archive from [releases section](https://github.com/Rarst/fragment-cache/releases).\r\n\r\nOr install in plugin directory via [Composer](https://getcomposer.org/):\r\n\r\n    composer create-project rarst/fragment-cache --no-dev\r\n\r\n# Frequently Asked Questions\r\n\r\n## Why fragments don't recognize logged in users / current page?\r\n\r\nFragment Cache implements soft expiration - when fragments expire, they are regenerated asynchronously and do not take time in front end page load. The side effect is that it is impossible to preserve context precisely and in generic way.\r\n\r\nFragments that must be aware of users or other context information should be excluded from caching or handled by custom implementation, that properly handles that specific context.\r\n\r\n## How to disable caching?\r\n\r\n### Disable handler\r\n\r\nCaching for the fragment type can be disabled by manipulating main plugin object:\r\n\r\n```php\r\nglobal $fragment_cache;\r\n\r\n// completely remove handler, only use before init\r\nunset( $fragment_cache['widget'] );\r\n\r\n// or disable handler, use after init\r\n$fragment_cache['widget']-\u003edisable();\r\n```\r\n\r\n### Skip individual fragments\r\n\r\nCaching for individual fragments can be disabled by using `fc_skip_cache` hook.\r\n\r\n```php\r\nadd_filter( 'fc_skip_cache', function ( $skip, $type, $name, $args, $salt ) {\r\n\r\n\t// Widget by class.\r\n\tif ( 'widget' === $type \u0026\u0026 is_a( $args['callback'][0], 'WP_Widget_Meta' ) ) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t// Menu by theme location.\r\n\tif ( 'menu' === $type \u0026\u0026 isset( $args['theme_location'] ) \u0026\u0026 'header' === $args['theme_location'] ) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t// Menu by name.\r\n\tif ( 'menu' === $type \u0026\u0026 isset( $args['menu'] ) ) {\r\n\r\n\t\tif ( 'Menu with login' === $args['menu'] ) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tif ( is_a( $args['menu'], 'WP_Term' ) \u0026\u0026 'Menu with login' === $args['menu']-\u003ename ) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\t// Gallery by ID of post.\r\n\tif ( 'gallery' === $type \u0026\u0026 123 === $args['post_id'] ) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\treturn $skip;\r\n}, 10, 5 );\r\n```\r\n\r\n# License Info\r\n\r\nFragment Cache own code is licensed under GPLv2+ and it makes use of code from:\r\n\r\n - Composer (MIT)\r\n - Pimple (MIT)\r\n - TLC Transients (GPLv2+)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRarst%2Ffragment-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRarst%2Ffragment-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRarst%2Ffragment-cache/lists"}