{"id":21931318,"url":"https://github.com/themeplate/cache","last_synced_at":"2026-03-10T12:35:47.782Z","repository":{"id":57068251,"uuid":"236401731","full_name":"ThemePlate/Cache","owner":"ThemePlate","description":"Convenient fragment caching methods","archived":false,"fork":false,"pushed_at":"2025-03-01T07:54:41.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-01T08:24:31.649Z","etag":null,"topics":["cache","wordpress","wordpress-cache"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThemePlate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-27T01:29:20.000Z","updated_at":"2025-03-01T07:54:39.000Z","dependencies_parsed_at":"2024-05-20T07:25:26.731Z","dependency_job_id":"e3b05807-35c3-4eee-9ed9-ae914edb5e04","html_url":"https://github.com/ThemePlate/Cache","commit_stats":{"total_commits":103,"total_committers":1,"mean_commits":103.0,"dds":0.0,"last_synced_commit":"ee61305fadcdd09586a9787af2b61729fd877efa"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThemePlate%2FCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThemePlate%2FCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThemePlate%2FCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThemePlate%2FCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThemePlate","download_url":"https://codeload.github.com/ThemePlate/Cache/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959453,"owners_count":20538628,"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","wordpress","wordpress-cache"],"created_at":"2024-11-28T23:13:31.369Z","updated_at":"2026-03-10T12:35:47.738Z","avatar_url":"https://github.com/ThemePlate.png","language":"PHP","readme":"# ThemePlate Cache\n\n## Usage\n\n```php\nuse ThemePlate\\Cache;\n\nCache::remember( 'unique_key', function() {\n    return expensive_task();\n}, MINUTE_IN_SECONDS );\n\nCache::forget( 'unique_key' );\n\nCache::file( 'special_key', 'path_to_file' );\n\n$processor = Cache::processor();\n\n$processor-\u003ereport( function( $output ) {\n    error_log( print_r( $output, true ) );\n} );\n\n\nfunction hourly_moment() {\n    return 'to remember ' . time();\n}\n\nCache::remember( 'unique_key', 'hourly_moment', HOUR_IN_SECONDS );\n```\n\n### Force refresh value/s\n\n`\u003cWP_HOME\u003e/?tcs_refresh=\u003csingle_key\u003e`\n\n`\u003cWP_HOME\u003e/?tcs_refresh[]=\u003ckey1\u003e\u0026tcs_refresh[]=\u003ckey2\u003e`\n\n\u003e _works only when logged-in_\n\n### Cache::remember( $key, $callback, $expiration )\n\nRetrieve content from the cache or, if it doesn't exist, execute $callback and its result is returned then saved\n\n- **$key** _(string)(Required)_ Unique cache key to use\n- **$callback** _(callable)(Required)_ Function that returns data to store\n- **$expiration** _(int)(Optional)_ Number of seconds before entry expires. Default 0 (forever)\n\n### Cache::forget( $key, $default )\n\nRetrieve and delete the cache\n\n- **$key** _(string)(Required)_ Unique cache key to use\n- **$default** _(mixed)(Optional)_ To return if cache doesn't exist. Default `null`\n\n### Cache::file( $key, $path )\n\nLike `remember` but, uses the file contents and no expiration, automatically updates if the file is modified instead\n\n- **$key** _(string)(Required)_ Unique cache key to use\n- **$path** _(string)(Required)_ Path of the file to read\n\n### Cache::processor()\n\nSupport for soft-expiration, `Cache::remember`\\* and `Cache::file` updates in the background\n\n\u003e \\*Except for using anonymous function as callback (closure)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemeplate%2Fcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemeplate%2Fcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemeplate%2Fcache/lists"}