Add cache to lambda-proxy
Project description
lambda-proxy-cache
Add a caching layer to lambda-proxy
Install
$ pip install -U pip
$ pip install lambda-proxy-cache
Or install from source:
$ git clone https://github.com/vincentsarago/lambda-proxy-cache.git
$ cd lambda-proxy-cache
$ pip install -U pip
$ pip install -e .
Usage
from lambda_proxy_cache.proxy import API
from lambda_proxy_cache.backends.memcache import MemcachedCache
app = API(name="app", cache_layer=MemcachedCache("MyHostURL"))
@app.route('/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.route('/user/<name>/id', no_cache=True)
def print_id(name):
# Do something here
...
return ('OK', 'plain/text', id)
Contribution & Devellopement
Issues and pull requests are more than welcome.
Dev install & Pull-Request
$ git clone https://github.com/vincentsarago/lambda-proxy-cache.git
$ cd lambda-proxy-cache
$ pip install -e .[dev]
This repo is set to use pre-commit to run flake8, pydocstring and black ("uncompromising Python code formatter") when committing new code.
$ pre-commit install
$ git add .
$ git commit -m'my change'
black.........................Passed
Flake8........................Passed
Verifying PEP257 Compliance...Passed
$ git push origin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file lambda-proxy-cache-0.0.1.tar.gz
.
File metadata
- Download URL: lambda-proxy-cache-0.0.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddd135688319a003960c1e902f90b7399d287a4f96b3445677ef8d63328112d3 |
|
MD5 | 4738264c43cc9806484b5f0425b76d0e |
|
BLAKE2b-256 | ff7f9b8b60071aa39b9e88deb480526b4f136a0d32b3755681a48114506b191e |