{"id":19787644,"url":"https://github.com/bumble-tech/php-sic","last_synced_at":"2025-10-07T01:43:06.688Z","repository":{"id":60988717,"uuid":"543964445","full_name":"bumble-tech/php-sic","owner":"bumble-tech","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-07T10:29:30.000Z","size":49,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-30T23:35:08.986Z","etag":null,"topics":["php","php-extension"],"latest_commit_sha":null,"homepage":"","language":"C","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/bumble-tech.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}},"created_at":"2022-10-01T09:19:05.000Z","updated_at":"2023-08-18T14:28:49.000Z","dependencies_parsed_at":"2023-01-21T03:51:18.520Z","dependency_job_id":null,"html_url":"https://github.com/bumble-tech/php-sic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bumble-tech/php-sic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumble-tech%2Fphp-sic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumble-tech%2Fphp-sic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumble-tech%2Fphp-sic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumble-tech%2Fphp-sic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bumble-tech","download_url":"https://codeload.github.com/bumble-tech/php-sic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bumble-tech%2Fphp-sic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708056,"owners_count":26031932,"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-10-06T02:00:05.630Z","response_time":65,"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":["php","php-extension"],"created_at":"2024-11-12T06:24:02.876Z","updated_at":"2025-10-07T01:43:06.671Z","avatar_url":"https://github.com/bumble-tech.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Shared Integer Cache for PHP\n============================\n\n\nThe extension offers a set of operations to store an integer value\nin the shared memory, associated with a name (string identifier).\nEach value is to be atomically changed.\n\nSupported versions of PHP: 7.0+, 8.0+\n\n\n## The story\n\nThe extension appeared as during tackling with Lock Contention in APCu.\n\nIt allocates a number of segments in shared memory, each segment gets its own lock\nto perform the operation.\n\nEach value may have its own TTL or live forever\n\n## Build\n\nAssuming that PHP is already installed on the system\n\n```bash\ngit clone git@github.com:bumble-tech/php-sic.git\ncd php-sic\nphpize\n./configure\nmake\nmake test\n```\n\n## Setup\n\nINI records related to the extension\n\n```ini\n\n# Attach the extension in the runtime\nextension=sic.so\n\n; Enable/disable the extension\n;\n; for the moment, it can only be set in PHP_INI_SYSTEM\n;\n; Boolean: 1/0/on/off/true/false\n; Default Value: off\nsic.enabled = on\n\n; The number of \"segments\" to create on startup\n;\n; Integer: should be \u003e 0\n; Default Value: 10\nsic.shard_num = 10\n\n; The segment size\n;\n; Memory: 1M/100K/etc...\n; Default Value: 1M\nsic.shard_size=200K\n```\n\n\n## Functions\n\n### bool sic_set(string key, int value[, int ttl])\n\nForcibly sets the value\n\n\n#### Agruments\n\n**key** *string*, the key associated with the value\\\n**value** *int*, the new value to set\\\n**ttl** *int*, time to live in seconds\n\n\n#### Return value\n\n**true** on success, **false** otherwise\n\n\n### bool sic_add(string key, int value[, int ttl])\n\nCreates a value in the storage. Fails if a value with such a name already exists.\n\n#### Agruments\n\n**key** *string*, the key associated with the value\\\n**value** *int*, the new value to set\\\n**ttl** *int*, time to live in seconds\n\n\n#### Return value\n\n**true** on success, **false** otherwise\n\n\n### bool sic_del(string key)\n\nRemoves the value from the storage. Fails if the value doesn't exists.\n\n#### Agruments\n\n**key** *string*, the key associated with the value\\\n\n\n#### Return value\n\n**true** on success, **false** otherwise\n\n\n### int|false sic_get(string key)\n\nRetreives the value from the storage\n\n#### Agruments\n\n**key** *string*, the key associated with the value\n\n\n#### Return value\n\n**false** if error occured or the value does not exists, **int** - the value, otherwise\n\n\n### bool sic_exists(string key)\n\nChecks whether the value exists in the storage\n\n#### Agruments\n\n**key** *string*, the key associated with the value\n\n\n#### Return value\n\n**false** if error occured or the value does not exists, **true** otherwise\n\n\n\n### int|false sic_inc(string key[, int inc_value[, int ttl]])\n\nIncrements the value, fails if such a key does not exist\n\n#### Agruments\n\n**key** *string*, the key associated with the value\\\n**value** *int*, value of increment\\\n**ttl** *int*, time to live in seconds\n\n\n#### Return value\n\n**false** if error occured or the value does not exists, **int** - the new value otherwise\n\n\n### int|false sic_dec(string key[, int inc_value[, int ttl]])\n\nIncrements the value, fails if such a key does not exist\n\n#### Agruments\n\n**key** *string*, the key associated with the value\\\n**value** *int*, value of decrement\\\n**ttl** *int*, time to live in seconds\n\n\n#### Return value\n\n**false** if error occured or the value does not exists, **int** - the new value otherwise\n\n\n\n### bool sic_cas(string key, int old_value, int new_value)\n\nUpdates the value using Compare-And-Swap semantic. Updates the value if the current value is expected (== **old_value**)\n\n#### Agruments\n\n**key** *string*, the key associated with the value\\\n**old_value** *int*, expected value\\\n**new_value** *int*, the new value to set \n\n\n#### Return value\n\n**false** if error occured or the value does not exists, **int** - the new value otherwise\n\n\n### bool sic_gc()\n\nRuns Garbadge Collection\n\n#### Return value\n\n**false** if error occured\n\n\n\n\n### array sic_info()\n\nReturns info about segments, an element for each segment:\n\n\n**size** *int* the size of the segment in bytes\\\n**unused_size** *int* how much memory is not used yet in the segment, bytes\\\n**used_cnt** *int* number of stored items\\\n**used_data_size** *int* how much memory is used, bytes\\\n**frag_err_cnt** *int* \\\n**oom_err_cnt** *int*\n\n## Development\n\nIn case API of the extension needs to be modified it should be done via editing sic.stub.php (do not edit any _arginfo* files as they are autogenerated) and calling https://github.com/php/php-src/blob/master/build/gen_stub.php afterwards.\nFor more information please see\n* https://externals.io/message/105970\n* https://stackoverflow.com/questions/66194531/how-to-compile-php-module-in-php8-0-that-used-to-use-tsrmls-cc-in-php7-but-is-d\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbumble-tech%2Fphp-sic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbumble-tech%2Fphp-sic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbumble-tech%2Fphp-sic/lists"}