Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vincentsarago/lambda-proxy-cache
A lambda-proxy plugin to add a caching layer
https://github.com/vincentsarago/lambda-proxy-cache
Last synced: about 1 month ago
JSON representation
A lambda-proxy plugin to add a caching layer
- Host: GitHub
- URL: https://github.com/vincentsarago/lambda-proxy-cache
- Owner: vincentsarago
- License: bsd-3-clause
- Created: 2019-06-29T04:09:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-17T05:49:51.000Z (over 4 years ago)
- Last Synced: 2024-09-28T09:09:35.863Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 45.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# lambda-proxy-cache
[![Packaging status](https://badge.fury.io/py/lambda-proxy-cache.svg)](https://badge.fury.io/py/lambda-proxy-cache)
[![CircleCI](https://circleci.com/gh/vincentsarago/lambda-proxy-cache.svg?style=svg)](https://circleci.com/gh/vincentsarago/lambda-proxy-cache)
[![codecov](https://codecov.io/gh/vincentsarago/lambda-proxy-cache/branch/master/graph/badge.svg)](https://codecov.io/gh/vincentsarago/lambda-proxy-cache)Add a caching layer to [lambda-proxy](https://github.com/vincentsarago/lambda-proxy)
## Install
```bash
$ pip install -U pip
$ pip install lambda-proxy-cache
```Or install from source:
```bash
$ git clone https://github.com/vincentsarago/lambda-proxy-cache.git
$ cd lambda-proxy-cache
$ pip install -U pip
$ pip install -e .
```# Usage
```python
from lambda_proxy_cache.proxy import API
from lambda_proxy_cache.backends.memcache import MemcachedCacheapp = API(name="app", cache_layer=MemcachedCache("MyHostURL"))
@app.get('/user/')
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//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**
```bash
$ 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.
```bash
$ pre-commit install
$ git add .
$ git commit -m'my change'
black.........................Passed
Flake8........................Passed
Verifying PEP257 Compliance...Passed
$ git push origin
```