{"id":22955211,"url":"https://github.com/hamidrabedi/pyinmem","last_synced_at":"2025-07-03T06:01:58.226Z","repository":{"id":224106134,"uuid":"762330517","full_name":"hamidrabedi/pyinmem","owner":"hamidrabedi","description":"lightweight, in-memory data store written in Python","archived":false,"fork":false,"pushed_at":"2024-04-03T17:28:52.000Z","size":94,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T14:58:23.389Z","etag":null,"topics":["cache","in-memory-database","python","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hamidrabedi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-23T14:57:45.000Z","updated_at":"2024-07-20T21:19:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"a712a0da-971c-4ad4-b03d-79826fa9d51b","html_url":"https://github.com/hamidrabedi/pyinmem","commit_stats":null,"previous_names":["hamidrabedi/pyinmem"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hamidrabedi/pyinmem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidrabedi%2Fpyinmem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidrabedi%2Fpyinmem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidrabedi%2Fpyinmem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidrabedi%2Fpyinmem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hamidrabedi","download_url":"https://codeload.github.com/hamidrabedi/pyinmem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidrabedi%2Fpyinmem/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263271464,"owners_count":23440393,"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","in-memory-database","python","redis"],"created_at":"2024-12-14T16:28:35.107Z","updated_at":"2025-07-03T06:01:58.188Z","avatar_url":"https://github.com/hamidrabedi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyInMemStore\n\nPyInMemStore is a lightweight, in-memory data store written in Python. It provides a simple way to store and manipulate data structures such as strings, lists, sets, and sorted sets. The store offers thread-safe operations and supports key expiry, similar to Redis.\n\n## Features\n\n- Basic data types: Strings, Lists, Sets, and Sorted Sets.\n- Thread-safe operations.\n- Key expiry functionality.\n- Dynamic method dispatching based on data type.\n- Easy extensibility for additional data types and operations.\n\n## How to install\n```\npip install pyinmem\n```\n\n## Data Types and Operations\n\n### String\n\n- `set(key, value, ttl=None)`: Set a string value under a key. Optionally, specify a Time-To-Live (TTL) in seconds.\n- `get(key)`: Retrieve the string value for a given key.\n\n### List\n\n- `lpush(key, value)`: Push a value to the beginning of a list at a given key.\n- `rpop(key)`: Pop a value from the end of a list at a given key.\n- `llen(key)`: Get the length of the list at a given key.\n\n### Set\n\n- `sadd(key, *values)`: Add one or more values to a set at a given key.\n- `srem(key, *values)`: Remove one or more values from a set at a given key.\n- `smembers(key)`: Get all the members of the set at a given key.\n- `sis_member(key, value)`: Check if a value is a member of the set at a given key.\n\n### Sorted Set\n\n- `zadd(key, scores)`: Add one or more member-score pairs to a sorted set at a given key.\n- `zrange(key, start, stop)`: Get a range of members from a sorted set at a given key, sorted by score.\n- `zscore(key, member)`: Get the score of a member in a sorted set at a given key.\n\n## Usage\n\n```python\nfrom pyinmemstore import PyInMemStore\n\nstore = PyInMemStore(save_data=True)\n\n\nstore.set('hello', 'world')\nprint(store.get('hello'))\n\n\nstore.lpush('mylist', 'hello')\nstore.lpush('mylist', 'world')\nprint(store.rpop('mylist'))\n\n\nstore.sadd('myset', 'hello', 'world')\nprint(store.smembers('myset'))\n\n\nstore.zadd('my_sorted_set', {'Alice': 100, 'Bob': 90})\nprint(store.zrange('my_sorted_set', 0, -1))\nprint(store.zscore('my_sorted_set', 'Alice'))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamidrabedi%2Fpyinmem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhamidrabedi%2Fpyinmem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamidrabedi%2Fpyinmem/lists"}