{"id":17973196,"url":"https://github.com/nabeghe/mem-php","last_synced_at":"2025-08-01T17:09:32.772Z","repository":{"id":259065907,"uuid":"876325834","full_name":"nabeghe/mem-php","owner":"nabeghe","description":"A cool real-time cache using static variable that lets you group keys.","archived":false,"fork":false,"pushed_at":"2025-01-26T13:38:21.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T08:44:59.788Z","etag":null,"topics":["cache","caching","caching-lib","helper","library","php","php-cache","php-cacher","php-helper","php-library","php-memcached","php-memory","realtime","static"],"latest_commit_sha":null,"homepage":"","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/nabeghe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-10-21T19:24:28.000Z","updated_at":"2025-01-26T13:37:44.000Z","dependencies_parsed_at":"2024-10-22T22:32:10.409Z","dependency_job_id":null,"html_url":"https://github.com/nabeghe/mem-php","commit_stats":null,"previous_names":["nabeghe/mem-php"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Fmem-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Fmem-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Fmem-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Fmem-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabeghe","download_url":"https://codeload.github.com/nabeghe/mem-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245463053,"owners_count":20619602,"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","caching","caching-lib","helper","library","php","php-cache","php-cacher","php-helper","php-library","php-memcached","php-memory","realtime","static"],"created_at":"2024-10-29T16:27:54.530Z","updated_at":"2025-08-01T17:09:32.758Z","avatar_url":"https://github.com/nabeghe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mem (Simple Realtime Cache for PHP)\n\n\u003e A cool real-time cache using static variable that lets you group keys.\n\n## 🫡 Usage\n\n### 🚀 Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require nabeghe/mem\n```\n\n### Methods Syntax\n\n```php\n// Checks if a key exists in a cache group.\nMem::has(mixed $key, mixed $group = 'default'): bool\n\n// Returns the first key of an item that matches the regex.\nMem::match($regex, $group = 'default'): ?string\n\n// Returns items whose keys match the regex.\nMem::matches($regex, $group = 'default'): ?array\n\n// Checks if a group exists.\nMem::hasGroup(mixed $group): bool\n\n// Returns the value of a key from a group.\nMem::get(mixed $key, mixed $group = 'default', mixed $default = null): bool\n\n// Changes the value of a key in a group.\nMem::set(mixed $key, mixed $value, mixed $group = 'default'): bool\n\n// Deletes a key from a group.\nMem::del($key, $group = 'default'): bool\n\n// Deletes items based on key matching with regex.\nMem::delMatches($regex, $group = 'default'): bool\n\n// Returns all storages (groups) and their keys.\nMem::all(): array\n\n// Returns all keys and values of a group.\nMem::group($group = 'default'): Storage\n\n// Returns the number of existing groups.\nMem::groupsCount(): int\n\n// Clears the entire group.\nMem::drop($group = 'default'): bool\n\n// Clears the entire cache.\nMem::reset(): bool\n\n```\n\n### Configuration\n\nThe `config` method is used for configuration, with the first argument being the group name \u0026 the second argument as an array to config that group.\nIf the second argument is `false` or not set, it returns the current config.\n\nThe `configProp` method retrieves a key's value from the config, with the key and group name as parameters.\n\nThe default config value is in `DEFAULT_CONFIG` const.\n\nCurrently, there's only one configuration, `length_limit`, with a default value of `-1`, which defines the group size.\nWhen the item count exceeds this, the first item is removed.\n`-1` means unlimited, also, `0` is currently not useful \u0026 should not be used.\n\n```php\nMem::config('default', ['length_limit' =\u003e 3]);\n\nMem::set('item_1', 'value 1');\nMem::set('item_2', 'value 2');\nMem::set('item_3', 'value 3');\nMem::set('item_4', 'value 4');\n\n/*\n * Items in the default group:\n *  [\n *      'item_2' =\u003e 'value 2',\n *      'item_3' =\u003e 'value 3',\n *      'item_4' =\u003e 'value 4'\n *  ]\n */\n```\n\n## 📖 License\n\nLicensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeghe%2Fmem-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabeghe%2Fmem-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeghe%2Fmem-php/lists"}