{"id":26796426,"url":"https://github.com/peterujah/cache","last_synced_at":"2025-04-22T19:57:48.296Z","repository":{"id":57038179,"uuid":"440533295","full_name":"peterujah/cache","owner":"peterujah","description":"A simple php file cache","archived":false,"fork":false,"pushed_at":"2023-10-22T10:26:36.000Z","size":65,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T18:18:34.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterujah.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}},"created_at":"2021-12-21T13:51:19.000Z","updated_at":"2022-05-08T17:29:31.000Z","dependencies_parsed_at":"2022-08-24T00:51:07.746Z","dependency_job_id":"1bded387-a6c9-4c62-afe3-4c88c66611de","html_url":"https://github.com/peterujah/cache","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"66ec3d6cf939c8c942589d297ede8a09b625237e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterujah","download_url":"https://codeload.github.com/peterujah/cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250315960,"owners_count":21410473,"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":[],"created_at":"2025-03-29T18:18:40.370Z","updated_at":"2025-04-22T19:57:48.266Z","avatar_url":"https://github.com/peterujah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cache\nA simple php file cache.\nThe Cache is designed to simplify the process of caching data in PHP applications. It provides various methods for configuration, data caching, retrieval, and cache management. It helps to reduce database queries, API calls, or expensive computations by storing the results in the cache.\n\n## Installation\n\nInstallation is super-easy via Composer:\n```md\ncomposer require peterujah/cache\n```\n# USAGES\n\nInitialize DBController with configuration array\n\n```php\nuse Peterujah\\NanoBlock\\Cache;\n$cache = new Cache(\"CACHE_NAME\", __DIR__ . \"/temp/caches/\");\n```\n\nQuery database and save response for later use\n\n```php\n$cache-\u003esetExpire(7200);\n$user = $cache-\u003eonExpired(\"LIST\", function () use($connConfig, $user_id){\n\t$conn_handler = new Peterujah\\NanoBlock\\DBController($connConfig);\n\t$conn_handler-\u003eprepare('\n\t      SELECT * FROM user_table\n\t      WHERE user_id = :fund_user_id\n\t      LIMIT 1\n\t');\n\t$conn_handler-\u003ebind(':fund_user_id', $user_id);\n\t$conn_handler-\u003eexecute();\n\t$user = $conn_handler-\u003egetOne();\n\t$conn_handler-\u003efree();\n\treturn  array(\n\t    \"user\" =\u003e $user,\n\t    \"time\" =\u003e time(),\n\t    \"morething\" =\u003e \"More\"\n\t);\n});\n```\n\n Sets the cache debugging mode, the default is false\n \n```php\n$cache-\u003esetDebugMode(true|false);\n```\n\nSets the cache file extension type default is JSON\n```php\n$cache-\u003esetExtension(Cache::PHP | Cache::JSON | Cache::TEXT);\n```\n\nEnable the cache to store secure data available only with php file extension, the default is true.\n\n```php\n$cache-\u003eenableSecureAccess(true | false);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterujah%2Fcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fcache/lists"}