{ "info": { "author": "Ivan Lee", "author_email": "miracle.ivanlee@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "YoTon\r\n=========\r\n\r\n.. image:: https://travis-ci.org/ivannotes/yoton.svg?branch=master\r\n :target: https://travis-ci.org/ivannotes/yoton\r\n\r\nYoTon is an util for cache, it simplifies cache with a decorator.\r\n\r\nInstall\r\n---------------------\r\n\r\n.. code-block:: bash\r\n\r\n $ pip install yoton\r\n\r\nConfiguration\r\n----------------------\r\n\r\n.. code-block:: python\r\n\r\n redis_server_config = {\r\n \"default\": {\r\n \"host\": \"localhost\",\r\n \"port\": 6379,\r\n \"db\": 1\r\n },\r\n \"server_a\": {\r\n \"host\": \"localhost\",\r\n \"port\": 6378,\r\n \"db\": 2,\r\n }\r\n }\r\n yoton = YoTon(redis_server_config)\r\n \r\nApply To Function\r\n----------------------\r\n\r\n.. code-block:: python\r\n\r\n @yoton.cache(key_pattern=\"dummy_cache_key\", expire_seconds=60)\r\n def dummy_func():\r\n return \"hello\"\r\n\r\n >> dummy_func() # call the function\r\n \"hello\" set in the cache\r\n\r\nKey Pattern\r\n----------------------\r\n\r\nThe cache key is using python's string format syntax, you can find it here\r\n\r\n.. code-block:: python\r\n\r\n @youton.cache(key_pattern=\"dummy:{a}_{b}_{c}\", expire_seconds=60)\r\n def dummy_func_with_params(a, b, c=3):\r\n return a + b + c\r\n\r\nComplex object in parameters\r\n\r\n.. code-block:: python\r\n\r\n @youton.cache(key_pattern=\"dummy:{a.id}_{b.name}\", expire_seconds=60)\r\n def dummy_func_with_params(a, b):\r\n return a + b\r\n\r\nSelect Database\r\n----------------------\r\n\r\n.. code-block:: python\r\n\r\n @yoton.cache(key_pattern=\"dummy_cache_key\", database=\"test\", expire_seconds=60)\r\n def dummy_func_database():\r\n return \"hello\"\r\n\r\nCustomized Formatter\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n @yoton.cache(key_pattern=\"dummy_cache_key\", key_formatter=CustomizedFormatter(), expire_seconds=60)\r\n def dummy_func_keyforamtter():\r\n pass\r\n\r\nApply Cache To Instance Method\r\n-------------------------------\r\n\r\n.. code-block:: python\r\n\r\n class DummyClass(object):\r\n\r\n @yoton.cache(key_pattern=\"instance_method\")\r\n def instance_method(self):\r\n return \"hello\"\r\n\r\nMisc\r\n---------\r\n \r\n.. code-block:: python\r\n\r\n # call the function directly without touch cache\r\n dummy_func_with_params.call(a=1, b=2, c=3)\r\n\r\n # refresh cache data\r\n dummy_func_with_params.refresh_cache(a=1, b=2, c=3)\r\n\r\n # remove data in cache\r\n dummy_func_with_params.delete_cache(a=1, b=2, c=3)", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ivannotes/yoton", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "yoton", "package_url": "https://pypi.org/project/yoton/", "platform": "any", "project_url": "https://pypi.org/project/yoton/", "project_urls": { "Homepage": "https://github.com/ivannotes/yoton" }, "release_url": "https://pypi.org/project/yoton/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Cache decorator to make applying cache less pain", "version": "0.1.0" }, "last_serial": 2029845, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "c71622a00c7432db861d6e82be10bcff", "sha256": "2e2422e97f311df7528f9720c2f8fd8ed9f0ff3234b5e170b108a9b9fec65f21" }, "downloads": -1, "filename": "yoton-0.1.0-py2.7.egg", "has_sig": false, "md5_digest": "c71622a00c7432db861d6e82be10bcff", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 7859, "upload_time": "2016-03-26T08:47:43", "url": "https://files.pythonhosted.org/packages/5b/a0/8302627b4170afbf3703faae29f4641cd5e9147531fd983ff11a8000a546/yoton-0.1.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "cde74074f27bc731c3445ee17d53f607", "sha256": "450e9e86669422a8d0405c715185fd149d479076898fb3e299eb3c9643ced27f" }, "downloads": -1, "filename": "yoton-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cde74074f27bc731c3445ee17d53f607", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4172, "upload_time": "2016-03-26T11:38:52", "url": "https://files.pythonhosted.org/packages/57/cf/235ba392bd993c70289453c0904efabeea60d6cd3d3005b8e0d459117e15/yoton-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c71622a00c7432db861d6e82be10bcff", "sha256": "2e2422e97f311df7528f9720c2f8fd8ed9f0ff3234b5e170b108a9b9fec65f21" }, "downloads": -1, "filename": "yoton-0.1.0-py2.7.egg", "has_sig": false, "md5_digest": "c71622a00c7432db861d6e82be10bcff", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 7859, "upload_time": "2016-03-26T08:47:43", "url": "https://files.pythonhosted.org/packages/5b/a0/8302627b4170afbf3703faae29f4641cd5e9147531fd983ff11a8000a546/yoton-0.1.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "cde74074f27bc731c3445ee17d53f607", "sha256": "450e9e86669422a8d0405c715185fd149d479076898fb3e299eb3c9643ced27f" }, "downloads": -1, "filename": "yoton-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cde74074f27bc731c3445ee17d53f607", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4172, "upload_time": "2016-03-26T11:38:52", "url": "https://files.pythonhosted.org/packages/57/cf/235ba392bd993c70289453c0904efabeea60d6cd3d3005b8e0d459117e15/yoton-0.1.0.tar.gz" } ] }