{ "info": { "author": "MOBIO", "author_email": "contact@mobio.vn", "bugtrack_url": null, "classifiers": [], "description": "#

LRU Cache

\nTh\u01b0 vi\u1ec7n caching c\u1ee7a MOBIO. H\u1ed7 tr\u1ee3 cache tr\u00ean memory ho\u1eb7c Redis.\n\n#### C\u00e0i \u0111\u1eb7t:\n`pip3 install m-caching`\n\n#### S\u1eed d\u1ee5ng:\n```\n__store_type = StoreType.REDIS # for redis cache\n__store_type = StoreType.LOCAL # for memory cache\n__file_config = 'config-file-path'\n\nlru_cache = LruCache(store_type=__store_type, config_file_name=__file_config)\n\n```\nIgnore empty values from cache\n```\n__store_type = StoreType.REDIS\n__file_config = 'config-file-path'\nlru_cache = LruCache(store_type=__store_type, config_file_name=__file_config)\nlru_cache.accept_none(False) # => ignore none values\n``` \n\n#### Usage\ncache for class's function\n```\nclass TestCache:\n @lru_cache.add_for_class()\n def test(self, x):\n print(\"TestCache::test param %s\" % x)\n return x + 1\n\n @staticmethod\n @lru_cache.add()\n def test_static(x):\n print(\"TestCache::test_static test param %s\" % x)\n return x + 1\n```\n\ncache for normal function\n```\n@lru_cache.add()\ndef some_expensive_method(x):\n print(\"Calling some_expensive_method(\" + str(x) + \")\")\n return x + 200\n```\n\n#### Example config\n```\n[REDIS]\nhost=redis-server\nport=6379\ncache_prefix=test_cache\n```\n\n\n", "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/mobiovn", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "m-caching", "package_url": "https://pypi.org/project/m-caching/", "platform": "", "project_url": "https://pypi.org/project/m-caching/", "project_urls": { "Homepage": "https://github.com/mobiovn" }, "release_url": "https://pypi.org/project/m-caching/0.1.2/", "requires_dist": [ "redis" ], "requires_python": "", "summary": "Setup normal class to mobio lru cache", "version": "0.1.2" }, "last_serial": 5927556, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "bebb4cf5d7802acd1f7a11eff36063f0", "sha256": "9c0efa437d8deb4c7f44f6d4228c4e855abab160ac9f875badaac980f7355a10" }, "downloads": -1, "filename": "m_caching-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bebb4cf5d7802acd1f7a11eff36063f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6231, "upload_time": "2019-10-04T08:31:56", "url": "https://files.pythonhosted.org/packages/3f/38/7bbe558beb0cda73a65ba3d1a5cc3410272731b92c4adc5c280ee526f0ad/m_caching-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09386d53736f988dc910b5fca184e7fa", "sha256": "063255900b0c0430db03613a010fbf631cdd9ba009403de08031d2f905026103" }, "downloads": -1, "filename": "m-caching-0.1.1.tar.gz", "has_sig": false, "md5_digest": "09386d53736f988dc910b5fca184e7fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5862, "upload_time": "2019-10-04T08:31:58", "url": "https://files.pythonhosted.org/packages/de/76/d831c60ccd62c808701ecc734a63b500328dc37c02d9a1624e16bd98dc8b/m-caching-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "378bbbe9a919dc97b1158f9808dbf432", "sha256": "d6cd4110baab572edc7b80e824314880f9c6868420f51463846433e87b8167c4" }, "downloads": -1, "filename": "m_caching-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "378bbbe9a919dc97b1158f9808dbf432", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6340, "upload_time": "2019-10-04T09:42:53", "url": "https://files.pythonhosted.org/packages/0e/62/d77edba88bed0d9f078bd6af9432d2dd17920e781df91a64245baa9f0b71/m_caching-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb36eccf2f6e451aec2e7d3443aa2636", "sha256": "06817e1ecfdb43823edc00970f404468dc551dce41198a8bba1e4237163d68ab" }, "downloads": -1, "filename": "m-caching-0.1.2.tar.gz", "has_sig": false, "md5_digest": "cb36eccf2f6e451aec2e7d3443aa2636", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5930, "upload_time": "2019-10-04T09:42:55", "url": "https://files.pythonhosted.org/packages/c1/35/f1871b331e7b1dca7ef70b8e38c5084a1700ba90ded8a943d50df2246273/m-caching-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "378bbbe9a919dc97b1158f9808dbf432", "sha256": "d6cd4110baab572edc7b80e824314880f9c6868420f51463846433e87b8167c4" }, "downloads": -1, "filename": "m_caching-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "378bbbe9a919dc97b1158f9808dbf432", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6340, "upload_time": "2019-10-04T09:42:53", "url": "https://files.pythonhosted.org/packages/0e/62/d77edba88bed0d9f078bd6af9432d2dd17920e781df91a64245baa9f0b71/m_caching-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb36eccf2f6e451aec2e7d3443aa2636", "sha256": "06817e1ecfdb43823edc00970f404468dc551dce41198a8bba1e4237163d68ab" }, "downloads": -1, "filename": "m-caching-0.1.2.tar.gz", "has_sig": false, "md5_digest": "cb36eccf2f6e451aec2e7d3443aa2636", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5930, "upload_time": "2019-10-04T09:42:55", "url": "https://files.pythonhosted.org/packages/c1/35/f1871b331e7b1dca7ef70b8e38c5084a1700ba90ded8a943d50df2246273/m-caching-0.1.2.tar.gz" } ] }