# do_utils
Utils write for common usage.
## do_time
Func timer - count func time with decorator
- Usage:
```python
from do_utils import do_time
from time import sleep
@do_time()
def do_print():
sleep(0.01)
class A(object):
@do_time(func=False)
def do_print(self):
sleep(0.01)
```
## do_cache
Do cache for GET request url handler in Tornado server
```text
do_cache:
do cahche for request with uri & user & params
cache_key include (protocol, host_name, path, md5(current_user, params))
cache_expire depend on kwargs expire, the default is 5*60s
cache from write_buffer that have not flushed wrote by self.write() and will be flush
if cache is none:
get data & return data & do cache
else:
return cache
do_api_cache:
do cache for api handler
if status_code == 200:
do_cache
do_temp_cache:
do cache for template handler
```
- Usage:
```python
from do_utils import do_api_cache, do_temp_cache
class ApiHandler(object):
@do_api_cache(10)
def get(self):
print 'get api'
@do_temp_cache(10, with_user=False)
def get(self):
print 'get template'
```
## Change History
- v0.0.1
```text
do utils
do api/template cache for tornado server with redis
```
- v0.0.2
```text
bugfix for install_requires cannot using 'requirements.txt'
add prefix for cache_key: 'cache:'
```
- v0.0.3
```text
bugfix for Python3 and dependence
```
- v0.0.4.2
```text
bugfix for Python3 and update dependence
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hustjiangtao/do_utils",
"name": "do-utils",
"maintainer": null,
"docs_url": null,
"requires_python": ">=2.7.14",
"maintainer_email": null,
"keywords": "utils, do_utils, cache, time, do_cache, do_time",
"author": "jiangtao",
"author_email": "jiangtao.work@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b7/c7/a1c9cee77fc4887062a6523244451014cf6e284cce239a7b9cb1879ac47f/do_utils-0.0.4.2.tar.gz",
"platform": null,
"description": "# do_utils\nUtils write for common usage.\n\n## do_time\n\nFunc timer - count func time with decorator\n\n- Usage:\n\n```python\nfrom do_utils import do_time\nfrom time import sleep\n\n@do_time()\ndef do_print():\n sleep(0.01)\n\nclass A(object):\n @do_time(func=False)\n def do_print(self):\n sleep(0.01)\n```\n\n## do_cache\n\nDo cache for GET request url handler in Tornado server\n\n```text\ndo_cache:\n do cahche for request with uri & user & params\n cache_key include (protocol, host_name, path, md5(current_user, params))\n cache_expire depend on kwargs expire, the default is 5*60s\n cache from write_buffer that have not flushed wrote by self.write() and will be flush\n if cache is none:\n get data & return data & do cache\n else:\n return cache\ndo_api_cache:\n do cache for api handler\n if status_code == 200:\n do_cache\ndo_temp_cache:\n do cache for template handler\n```\n\n- Usage:\n\n```python\nfrom do_utils import do_api_cache, do_temp_cache\n\nclass ApiHandler(object):\n @do_api_cache(10)\n def get(self):\n print 'get api'\n\n @do_temp_cache(10, with_user=False)\n def get(self):\n print 'get template'\n```\n\n## Change History\n\n- v0.0.1\n\n```text\ndo utils\ndo api/template cache for tornado server with redis\n```\n\n- v0.0.2\n\n```text\nbugfix for install_requires cannot using 'requirements.txt'\nadd prefix for cache_key: 'cache:'\n```\n\n- v0.0.3\n\n```text\nbugfix for Python3 and dependence\n```\n\n- v0.0.4.2\n\n```text\nbugfix for Python3 and update dependence\n```\n",
"bugtrack_url": null,
"license": "http://www.apache.org/licenses/LICENSE-2.0",
"summary": "Utils for tornado api cache, function timer.",
"version": "0.0.4.2",
"project_urls": {
"Homepage": "https://github.com/hustjiangtao/do_utils"
},
"split_keywords": [
"utils",
" do_utils",
" cache",
" time",
" do_cache",
" do_time"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eed6cee5d9ba010f7878e47dcf158498c6ab59ddff3b94eb6265e48765652d9e",
"md5": "7701bd3e6737781dabd45997be2bc222",
"sha256": "781c483c8f3409d55d6bd326db3793f4eda8c2920f615b1636f06542a40b7902"
},
"downloads": -1,
"filename": "do_utils-0.0.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7701bd3e6737781dabd45997be2bc222",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=2.7.14",
"size": 10597,
"upload_time": "2024-07-18T11:09:15",
"upload_time_iso_8601": "2024-07-18T11:09:15.855029Z",
"url": "https://files.pythonhosted.org/packages/ee/d6/cee5d9ba010f7878e47dcf158498c6ab59ddff3b94eb6265e48765652d9e/do_utils-0.0.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b7c7a1c9cee77fc4887062a6523244451014cf6e284cce239a7b9cb1879ac47f",
"md5": "48f70f20275fcde5b306ff632b3a248f",
"sha256": "282be9c3b5802ebab0b240bb0553e713c1f46a7f3739e5839644df1f1234b1a3"
},
"downloads": -1,
"filename": "do_utils-0.0.4.2.tar.gz",
"has_sig": false,
"md5_digest": "48f70f20275fcde5b306ff632b3a248f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7.14",
"size": 9567,
"upload_time": "2024-07-18T11:09:17",
"upload_time_iso_8601": "2024-07-18T11:09:17.338069Z",
"url": "https://files.pythonhosted.org/packages/b7/c7/a1c9cee77fc4887062a6523244451014cf6e284cce239a7b9cb1879ac47f/do_utils-0.0.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-18 11:09:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hustjiangtao",
"github_project": "do_utils",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "ujson",
"specs": [
[
"==",
"1.35"
]
]
},
{
"name": "xlwt",
"specs": [
[
">=",
"1.3.0"
],
[
"<=",
"2.0.0"
]
]
},
{
"name": "openpyxl",
"specs": [
[
">=",
"2.6.2"
]
]
}
],
"lcname": "do-utils"
}