{ "info": { "author": "Sankalp Jonna", "author_email": "sankalpjonna@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# knowhere\n\nIn memory cache, a python implementation of [`zizou`](https://github.com/arriqaaq/zizou) with a different expiration policy\n\n![knowhere](http://66.42.57.109/knowhere.jpg)\n\n## Features\n\n* Store millions of entries\n* High concurrent thread-safe access\n* Expiration support\n* Shard support to avoid locks on whole db during any concurrent read/writes/deletes\n\n## Installation\n```sh\npip install knowhere\n```\n\n## Usage\n\n### Initialize\nshard_size should be a power of 2. This size must be set according to the number of keys you expect to be there in the cache at any given time.\n\n```python\nfrom datetime import timedelta\nfrom decimal import Decimal\n\nimport uuid, time, json, sys, knowhere\n\nc = knowhere.Cache(shard_size=2, eviction_interval=timedelta(seconds=10))\n\n```\n### Set\n```python\nc.set(\"key\", \"value\", ttl=timedelta(seconds=5))\n```\nDefault expiry will be set to 5 minutes if no ttl is specified\n\n### Get\n```python\nc.get(\"key\")\n```\n### Delete\n```python\nc.delete(\"key\")\n```\n### Flush\ndeletes all keys in the cache\n```python\nc.flush()\n```\n\n## Info\ngives all shards and number of keys in each shard as a json\n```python\nc.info()\n```\n\n## Keys\ngives a list of all keys in the cache\n```python\nc.keys()\n```\n\n## Expiration policy\nknowhere expires keys the same way redis does. You can find it [`here`]('https://redis.io/commands/expire#how-redis-expires-keys'). Specifically, this is what knowhere does on every eviction interval for each shard\n* Step 1: Get 20 random keys from the shard\n* Step 2: Delete all the keys which should be expired.\n* Step 3: If more than 4 of the 20 keys were expired, start again from step 1", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sankalpjonn/knowhere", "keywords": "cache,memory,in memory,expiration,ttl", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "knowhere", "package_url": "https://pypi.org/project/knowhere/", "platform": "", "project_url": "https://pypi.org/project/knowhere/", "project_urls": { "Homepage": "https://github.com/sankalpjonn/knowhere" }, "release_url": "https://pypi.org/project/knowhere/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "An in memory cache with efficient expiration", "version": "1.0.0" }, "last_serial": 4316293, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "dd3e902a5e73205ab0406da968a9946e", "sha256": "5b897b0265428c61f619ba04a27b65a4a8b807beedb8e08b5d8e69829b2e8f2f" }, "downloads": -1, "filename": "knowhere-1.0.0.tar.gz", "has_sig": false, "md5_digest": "dd3e902a5e73205ab0406da968a9946e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3341, "upload_time": "2018-09-27T13:55:33", "url": "https://files.pythonhosted.org/packages/54/58/da4de0ec55f0f78f49f5e4b45782cd717ccd4f26f98ba6864e382eb0c818/knowhere-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd3e902a5e73205ab0406da968a9946e", "sha256": "5b897b0265428c61f619ba04a27b65a4a8b807beedb8e08b5d8e69829b2e8f2f" }, "downloads": -1, "filename": "knowhere-1.0.0.tar.gz", "has_sig": false, "md5_digest": "dd3e902a5e73205ab0406da968a9946e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3341, "upload_time": "2018-09-27T13:55:33", "url": "https://files.pythonhosted.org/packages/54/58/da4de0ec55f0f78f49f5e4b45782cd717ccd4f26f98ba6864e382eb0c818/knowhere-1.0.0.tar.gz" } ] }