{"id":32174736,"url":"https://github.com/luizalabs/shared-memory-dict","last_synced_at":"2026-02-24T04:02:25.442Z","repository":{"id":37423726,"uuid":"283284165","full_name":"luizalabs/shared-memory-dict","owner":"luizalabs","description":"A very simple shared memory dict implementation","archived":false,"fork":false,"pushed_at":"2022-08-26T15:41:55.000Z","size":118,"stargazers_count":173,"open_issues_count":19,"forks_count":23,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-11-27T20:10:05.327Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","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/luizalabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-07-28T17:38:31.000Z","updated_at":"2025-09-26T18:41:30.000Z","dependencies_parsed_at":"2022-08-19T15:31:30.452Z","dependency_job_id":null,"html_url":"https://github.com/luizalabs/shared-memory-dict","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/luizalabs/shared-memory-dict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizalabs%2Fshared-memory-dict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizalabs%2Fshared-memory-dict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizalabs%2Fshared-memory-dict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizalabs%2Fshared-memory-dict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luizalabs","download_url":"https://codeload.github.com/luizalabs/shared-memory-dict/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizalabs%2Fshared-memory-dict/sbom","scorecard":{"id":603711,"data":{"date":"2025-08-11","repo":{"name":"github.com/luizalabs/shared-memory-dict","commit":"ff8726973064afaec23eceb09b031abf535a8b4b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":5,"reason":"Found 6/12 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/main.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/luizalabs/shared-memory-dict/release.yml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"26 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2022-190 / GHSA-2gwj-7jmv-h26r","Warn: Project is vulnerable to: PYSEC-2023-13 / GHSA-2hrw-hx67-34x6","Warn: Project is vulnerable to: PYSEC-2022-1 / GHSA-53qw-q765-4fww","Warn: Project is vulnerable to: PYSEC-2022-20 / GHSA-6cw3-g6wv-c2xv","Warn: Project is vulnerable to: PYSEC-2023-225 / GHSA-7h4p-27mh-hmrw","Warn: Project is vulnerable to: GHSA-7xr5-9hcq-chf9","Warn: Project is vulnerable to: PYSEC-2022-2 / GHSA-8c5j-9r9f-c6w8","Warn: Project is vulnerable to: PYSEC-2022-245 / GHSA-8x94-hmjh-97hq","Warn: Project is vulnerable to: PYSEC-2022-19 / GHSA-95rw-fx8r-36v6","Warn: Project is vulnerable to: PYSEC-2023-226 / GHSA-h8gc-pgj2-vjm3","Warn: Project is vulnerable to: PYSEC-2023-100 / GHSA-jh3w-4vvf-mjgr","Warn: Project is vulnerable to: PYSEC-2022-3 / GHSA-jrh2-hc4r-7jwx","Warn: Project is vulnerable to: PYSEC-2022-213 / GHSA-p64x-8rxx-wf6q","Warn: Project is vulnerable to: PYSEC-2023-12 / GHSA-q2jf-h9jm-m7p4","Warn: Project is vulnerable to: PYSEC-2023-222 / GHSA-qmf9-6jqf-j8fq","Warn: Project is vulnerable to: PYSEC-2022-304 / GHSA-qrw5-5h28-6cmg","Warn: Project is vulnerable to: PYSEC-2023-61 / GHSA-r3xc-prgr-mg9p","Warn: Project is vulnerable to: GHSA-rrqc-c2jx-6jgv","Warn: Project is vulnerable to: PYSEC-2021-439 / GHSA-v6rh-hp5x-86rv","Warn: Project is vulnerable to: PYSEC-2024-47 / GHSA-vm8q-m57g-pff3","Warn: Project is vulnerable to: PYSEC-2022-191 / GHSA-w24h-v9qh-8gxj","Warn: Project is vulnerable to: PYSEC-2024-28 / GHSA-xxj9-f6rv-m3x4","Warn: Project is vulnerable to: PYSEC-2022-42969","Warn: Project is vulnerable to: GHSA-2m57-hf25-phgg","Warn: Project is vulnerable to: PYSEC-2023-87 / GHSA-rrm6-wvj7-cwh2"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T01:06:48.346Z","repository_id":37423726,"created_at":"2025-08-21T01:06:48.346Z","updated_at":"2025-08-21T01:06:48.346Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29771041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:01:02.180Z","status":"ssl_error","status_checked_at":"2026-02-24T03:59:49.901Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest"],"created_at":"2025-10-21T19:07:47.982Z","updated_at":"2026-02-24T04:02:25.435Z","avatar_url":"https://github.com/luizalabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shared Memory Dict\n\nA very simple [shared memory](https://docs.python.org/3/library/multiprocessing.shared_memory.html) dict implementation.\n\n**Requires**: Python \u003e= 3.8\n\n```python\n\u003e\u003e\u003e # In the first Python interactive shell\n\u003e\u003e from shared_memory_dict import SharedMemoryDict\n\u003e\u003e smd = SharedMemoryDict(name='tokens', size=1024)\n\u003e\u003e smd['some-key'] = 'some-value-with-any-type'\n\u003e\u003e smd['some-key']\n'some-value-with-any-type'\n\n\u003e\u003e\u003e # In either the same shell or a new Python shell on the same machine\n\u003e\u003e existing_smd = SharedMemoryDict(name='tokens', size=1024)\n\u003e\u003e\u003e existing_smd['some-key']\n'some-value-with-any-type'\n\u003e\u003e\u003e existing_smd['new-key'] = 'some-value-with-any-type'\n\n\n\u003e\u003e\u003e # Back in the first Python interactive shell, smd reflects this change\n\u003e\u003e smd['new-key']\n'some-value-with-any-type'\n\n\u003e\u003e\u003e # Clean up from within the second Python shell\n\u003e\u003e\u003e existing_smd.shm.close()  # or \"del existing_smd\"\n\n\u003e\u003e\u003e # Clean up from within the first Python shell\n\u003e\u003e\u003e smd.shm.close()\n\u003e\u003e\u003e smd.shm.unlink()  # Free and release the shared memory block at the very end\n\u003e\u003e\u003e del smd  # use of smd after call unlink() is unsupported\n```\n\n\u003e The arg `name` defines the location of the memory block, so if you want to share the memory between process use the same name.\n\u003e The size (in bytes) occupied by the contents of the dictionary depends on the serialization used in storage. By default pickle is used.\n\n## Installation\n\nUsing `pip`:\n\n```shell\npip install shared-memory-dict\n```\n\n## Locks\n\nTo use [multiprocessing.Lock](https://docs.python.org/3.8/library/multiprocessing.html#multiprocessing.Lock) on write operations of shared memory dict set environment variable `SHARED_MEMORY_USE_LOCK=1`.\n\n## Serialization\n\nWe use [pickle](https://docs.python.org/3/library/pickle.html) as default to read and write the data into the shared memory block.\n\nYou can create a custom serializer by implementing the `dumps` and `loads` methods.\n\nCustom serializers should raise `SerializationError` if the serialization fails and `DeserializationError` if the deserialization fails. Both are defined in the `shared_memory_dict.serializers` module.\n\nAn example of a JSON serializer extracted from serializers module:\n\n```python\nNULL_BYTE: Final = b\"\\x00\"\n\n\nclass JSONSerializer:\n    def dumps(self, obj: dict) -\u003e bytes:\n        try:\n            return json.dumps(obj).encode() + NULL_BYTE\n        except (ValueError, TypeError):\n            raise SerializationError(obj)\n\n    def loads(self, data: bytes) -\u003e dict:\n        data = data.split(NULL_BYTE, 1)[0]\n        try:\n            return json.loads(data)\n        except json.JSONDecodeError:\n            raise DeserializationError(data)\n\n```\n\nNote: A null byte is used to separate the dictionary contents from the bytes that are in memory.\n\nTo use the custom serializer you must set it when creating a new shared memory dict instance:\n\n```python\n\u003e\u003e\u003e smd = SharedMemoryDict(name='tokens', size=1024, serializer=JSONSerializer())\n```\n\n### Caveat\n\nThe pickle module is not secure. Only unpickle data you trust.\n\nSee more [here](https://docs.python.org/3/library/pickle.html).\n\n## Django Cache Implementation\n\nThere's a [Django Cache Implementation](https://docs.djangoproject.com/en/3.0/topics/cache/) with Shared Memory Dict:\n\n```python\n# settings/base.py\nCACHES = {\n    'default': {\n        'BACKEND': 'shared_memory_dict.caches.django.SharedMemoryCache',\n        'LOCATION': 'memory',\n        'OPTIONS': {'MEMORY_BLOCK_SIZE': 1024}\n    }\n}\n```\n\n**Install with**: `pip install \"shared-memory-dict[django]\"`\n\n### Caveat\n\nWith Django cache implementation the keys only expire when they're read. Be careful with memory usage\n\n## AioCache Backend\n\nThere's also a [AioCache Backend Implementation](https://aiocache.readthedocs.io/en/latest/caches.html) with Shared Memory Dict:\n\n```python\nFrom aiocache import caches\n\ncaches.set_config({\n    'default': {\n        'cache': 'shared_memory_dict.caches.aiocache.SharedMemoryCache',\n        'size': 1024,\n    },\n})\n```\n\n\u003e This implementation is very based on aiocache [SimpleMemoryCache](https://aiocache.readthedocs.io/en/latest/caches.html#simplememorycache)\n\n**Install with**: `pip install \"shared-memory-dict[aiocache]\"`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizalabs%2Fshared-memory-dict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluizalabs%2Fshared-memory-dict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizalabs%2Fshared-memory-dict/lists"}