{ "info": { "author": "Vivek Narayanan, Fl\u00e1vio Juvenal, Sam Zaydel. Python 3 support by Omer Hanetz", "author_email": "flaviojuvenal@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: BSD License", "Topic :: Utilities" ], "description": "# redis-simple-cache\nredis-simple-cache is a pythonic interface for creating a cache over redis. \nIt provides simple decorators that can be added to any function to cache its return values.\n\nForked package with python 3 support.\nOriginal package is located here: https://github.com/vivekn/redis-simple-cache\n\nRequirements:\n-------------\nredis 3.2.1\n\nInstallation:\n-------------\n\n pip install redis-simple-cache-3k\n\nor to get the latest version\n\n git clone git://github.com/ohanetz/redis-simple-cache.git\n cd redis-simple-cache\n python setup.py install\n\nUsage:\n------\n\n from redis_cache import cache_it_json\n\n @cache_it_json(limit=1000, expire=60 * 60 * 24)\n def fib(n):\n if n == 0:\n return 0\n elif n == 1:\n return 1\n else:\n return fib(n-1) + fib(n-2)\n\n`limit` is the maximum number of keys, `expire` is the expire time in seconds. \nIt is always recommended to specify a expire time, since by default redis-server will only remove keys with an expire time set in a event of full memory. But if you wish your keys to never expire, set `expire` to `None`. \n**Note that function arguments and result must be pickleable, since cache_it uses the pickle module.**\n\nIt is also possible to use redis-simple-cache as a object-oriented cache:\n \n >> from redis_cache import SimpleCache\n >> c = SimpleCache(10) # cache that has a maximum limit of 10 keys\n >> c.store(\"foo\", \"bar\")\n >> c.get(\"foo\")\n 'bar'\n >> \"foo\" in c # efficient membership test, time-complexity O(1)\n True\n >> len(c) # efficient cardinality calculation, time-complexity O(1)\n 1\n >> c.keys() # returns all keys, time-complexity O(N) with N being the cache c cardinality\n set(['foo'])\n >> c.flush() # flushes the cache, time-complexity O(N) with N being the cache c cardinality\n >> \"foo\" in c\n False\n >> len(c)\n 0\n\nCheck out more examples in the test_rediscache.py file.\n\nAdvanced:\n---------\nAdvanced users can customize the decorators even more by passing a SimpleCache object. For example:\n \n my_cache = SimpleCache(limit=100, expire=60 * 60, hashkeys=True, host='localhost', port=6379, db=1, namespace='Fibonacci')\n @cache_it(cache=my_cache)\n def fib(n):\n # ...\n\n`hashkeys` parameter makes the SimpleCache to store keys in md5 hash. It is `True` by default in decorators, but `False` by default in a new SimpleCache object. \n`host`, `port` and `db` are the same redis config params used in StrictRedis class of redis-py.\nBy default, the `namespace` is the name of the module from which the decorated function is called, but it can be overridden with the `namespace` parameter. \n\nAUTHOR: Vivek Narayanan \n\nCONTRIBUTORS: \n\nFl\u00e1vio Juvenal\n\nSam Zaydel \n\nDavid Ng\n\nDJ Gilcrease\n\nJohannes Maximilian Toball\n\nRobert Marshall\n\nBen Hayden\n\n\nPython 3 support added by Omer Hanetz\n\nLICENSE: BSD", "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/ohanetz/redis-simple-cache-3k", "keywords": "decorator decorators redis cache", "license": "3-clause BSD", "maintainer": "", "maintainer_email": "", "name": "redis-simple-cache-3k", "package_url": "https://pypi.org/project/redis-simple-cache-3k/", "platform": "", "project_url": "https://pypi.org/project/redis-simple-cache-3k/", "project_urls": { "Homepage": "https://github.com/ohanetz/redis-simple-cache-3k" }, "release_url": "https://pypi.org/project/redis-simple-cache-3k/0.0.6.post1/", "requires_dist": null, "requires_python": "", "summary": "redis-simple-cache is a pythonic interface for creating a cache over redis. It provides simple decorators that can be added to any function to cache its return values.", "version": "0.0.6.post1" }, "last_serial": 5511560, "releases": { "0.0.6": [ { "comment_text": "", "digests": { "md5": "1badfa7e70e5b70d61292871271bfaed", "sha256": "f854b6c61dc1662d83f7c9c9dfc529afe6386a07e670ca41f56b6c6def25f2c1" }, "downloads": -1, "filename": "redis-simple-cache-3k-0.0.6.tar.gz", "has_sig": false, "md5_digest": "1badfa7e70e5b70d61292871271bfaed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9657, "upload_time": "2019-07-10T11:11:39", "url": "https://files.pythonhosted.org/packages/20/bb/414d043f47e36ea2cf29c92b6679511ad924b24ff0383204fde581fe8ffd/redis-simple-cache-3k-0.0.6.tar.gz" } ], "0.0.6.post1": [ { "comment_text": "", "digests": { "md5": "b78a81dbb2d63359d4940d837515bbe0", "sha256": "cc703b77bb0ed2a3fe82c888c3af665c97e1fa3d40d6ed1921c2f68a68278c04" }, "downloads": -1, "filename": "redis-simple-cache-3k-0.0.6.post1.tar.gz", "has_sig": false, "md5_digest": "b78a81dbb2d63359d4940d837515bbe0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9669, "upload_time": "2019-07-10T11:25:37", "url": "https://files.pythonhosted.org/packages/08/da/03e06b8a9698557caf558f1d0e03f98322e52c076371e3e3c4e0e738dd00/redis-simple-cache-3k-0.0.6.post1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b78a81dbb2d63359d4940d837515bbe0", "sha256": "cc703b77bb0ed2a3fe82c888c3af665c97e1fa3d40d6ed1921c2f68a68278c04" }, "downloads": -1, "filename": "redis-simple-cache-3k-0.0.6.post1.tar.gz", "has_sig": false, "md5_digest": "b78a81dbb2d63359d4940d837515bbe0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9669, "upload_time": "2019-07-10T11:25:37", "url": "https://files.pythonhosted.org/packages/08/da/03e06b8a9698557caf558f1d0e03f98322e52c076371e3e3c4e0e738dd00/redis-simple-cache-3k-0.0.6.post1.tar.gz" } ] }