{"id":33990372,"url":"https://github.com/dude920228/php-cache","last_synced_at":"2025-12-13T06:11:20.600Z","repository":{"id":44454205,"uuid":"135454839","full_name":"dude920228/php-cache","owner":"dude920228","description":"Cache implementation for php","archived":false,"fork":false,"pushed_at":"2022-07-11T08:42:38.000Z","size":1868,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-22T13:52:15.216Z","etag":null,"topics":["caching","caching-library","php","php-cache","sockets"],"latest_commit_sha":null,"homepage":null,"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/dude920228.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}},"created_at":"2018-05-30T14:28:49.000Z","updated_at":"2022-09-08T05:44:03.000Z","dependencies_parsed_at":"2022-09-21T18:42:26.376Z","dependency_job_id":null,"html_url":"https://github.com/dude920228/php-cache","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dude920228/php-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dude920228%2Fphp-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dude920228%2Fphp-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dude920228%2Fphp-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dude920228%2Fphp-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dude920228","download_url":"https://codeload.github.com/dude920228/php-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dude920228%2Fphp-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27701429,"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","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["caching","caching-library","php","php-cache","sockets"],"created_at":"2025-12-13T06:11:19.891Z","updated_at":"2025-12-13T06:11:20.592Z","avatar_url":"https://github.com/dude920228.png","language":"PHP","readme":"[![StyleCI](https://github.styleci.io/repos/135454839/shield?branch=master)](https://github.styleci.io/repos/135454839) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dude920228/php-cache/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dude920228/php-cache/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/dude920228/php-cache/badges/build.png?b=master)](https://scrutinizer-ci.com/g/dude920228/php-cache/build-status/master)\n# php-cache\nCache implementation for php\n\n# Usage:\n#### Prequests:\n- PHP 7.2\n- composer\n#### Installing via composer:\n```\ncomposer require kdudas/php-cache\n```\n#### Supperted data types:\n- String\n- Integer/Float/Double\n- Array\n- Objects\n#### Creating a new server instance\n```\n\u003c?php\n\nini_set('log_errors', 1);\nini_set('error_log', '/var/log/php-cache.log');\nrequire_once 'vendor/autoload.php';\n\nuse PhpCache\\CacheServer\\CacheServer;\nuse PhpCache\\ServiceManager\\ConfigAggregator;\nuse PhpCache\\ServiceManager\\ServiceManager;\n// You can import multiple config files to overwrite parameters in the basic config or add extra parameters, including dependency injection\n$config = include_once 'config.php';\n$configAggregator = new ConfigAggregator();\n$configAggregator-\u003eaddConfig($config);\n$serviceManager = new ServiceManager($configAggregator-\u003egetMergedConfig());\n$server = $serviceManager-\u003eget(CacheServer::class);\n$server-\u003erun();\n```\n#### Running the server:\n```\nphp testServer.php\n```\n#### OR\n```\nmv daemon.sh /etc/init.d/php-cache\nchmod +x /etc/init.d/php-cache\n# now you can use systemctl style service management\nsudo service php-cache start\n```\n##### Note: you can modify the contents of `daemon.sh` if you want to use other directories\n#### Configuration array:\n- `config`: Basic configuration array  \n-- `memoryLimit`: as the name suggests, after we exceed the limit, our data in the cache pool gets backed up to file system  \n-- `location`: server IP address or socket file location (string)  \n-- `port`: the port to run the sockets on (number)  \n-- `bufferSize`: how big chunks of data is being read from a stream (bytes)  \n-- `ttl`: time to live; how long an entry should take space up in the cache pool before being deleted (seconds)  \n-- `backupTime`: schedule backups (seconds)  \n-- `backupDir`: where to store backed up data? A backup is made when we are shutting down the server service, when the scheduled backup occures or our cache pool exceeded it's memory limit  \n-- `socketType`: which socket type should we use? Open a port on the network for the socket or create a file for the socket. Values must be either `file` (`CacheIOHandler::SOCKET_TYPE_FILE`) or `ip` (`CacheIOHandler::SOCKET_TYPE_IP`)  \n- `services`: service manager configuration  \n-- `aliases`: a name assigned for a real service (Example: `'cache-server' =\u003e CacheServer::class`)  \n-- `factories`: service name with factory name for service pairs  \n-- `invokables`: services with no dependencies  \n\n#### Creating a new client instance\n```\n\u003c?php\ninclude_once('vendor/autoload.php');\n\nuse PhpCache\\CacheClient\\CacheClient;\nuse PhpCache\\ServiceManager\\ServiceManager;\n\n$config = require_once 'config.php';\n$serviceManager = new ServiceManager($config);\n/* @var $client CacheClient */\n$client = $serviceManager-\u003eget(CacheClient::class);\n$client-\u003eset('test', 'ASD');\necho $client-\u003eget('test');\n```\n##### You can run the client either from browser or console\n```\nphp testClient.php\n```\n#### CLI Commands:\n`./phpCache get \u003ckey\u003e` gets entries for the specified key. If no key is specified, it returns all entries.  \n`./phpCache set \u003ckey\u003e \u003cvalue\u003e` pushes an entry to the cache pool with the given key - value pair.  \n`./phpCache delete \u003ckey\u003e` deletes the entry with the given key","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdude920228%2Fphp-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdude920228%2Fphp-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdude920228%2Fphp-cache/lists"}