为lambda-proxy添加缓存
项目描述
lambda-proxy-cache
为lambda-proxy添加缓存层
安装
$ pip install -U pip
$ pip install lambda-proxy-cache
或从源安装
$ git clone https://github.com/vincentsarago/lambda-proxy-cache.git
$ cd lambda-proxy-cache
$ pip install -U pip
$ pip install -e .
使用方法
from lambda_proxy_cache.proxy import API
from lambda_proxy_cache.backends.memcache import MemcachedCache
app = API(name="app", cache_layer=MemcachedCache("MyHostURL"))
@app.get('/user/<name>')
def print_name(name):
# Do something here
...
return ('OK', 'plain/text', name)
# By adding `no_cache=True` we tell the proxy to not use the cache
@app.get('/user/<name>/id', no_cache=True)
def print_id(name):
# Do something here
...
return ('OK', 'plain/text', id)
贡献与发展
问题和拉取请求非常欢迎。
开发安装与拉取请求
$ git clone https://github.com/vincentsarago/lambda-proxy-cache.git
$ cd lambda-proxy-cache
$ pip install -e .[dev]
此存储库设置为在提交新代码时使用pre-commit运行flake8,pydocstring和black(“坚定的Python代码格式化器”)。
$ pre-commit install
$ git add .
$ git commit -m'my change'
black.........................Passed
Flake8........................Passed
Verifying PEP257 Compliance...Passed
$ git push origin
项目详情
关闭
lambda-proxy-cache-0.0.4.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | fd2b8e007e14f6b04d921236de013756b959956dd06994e2ffa0d1cb6f4a4f40 |
|
MD5 | cd011c0e7f225677feabdaa7472aeb9b |
|
BLAKE2b-256 | 8190e4eaba432b1d195e519ed48dd84e99483fc2f72980bc4a7dec9b61925916 |