summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-29 10:09:55 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-29 10:09:55 +0000
commita76ed3707a52f03ace16baf589837332c88bcee2 (patch)
tree6fdecaa1b0830f7d1555f6a74a7426b8cf389818
parentec751f2be30b6e849e4e860c7521f3198c387475 (diff)
automatic import of python-fastapi-cache
-rw-r--r--.gitignore1
-rw-r--r--python-fastapi-cache.spec276
-rw-r--r--sources1
3 files changed, 278 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..b1b3203 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/fastapi-cache-0.1.0.tar.gz
diff --git a/python-fastapi-cache.spec b/python-fastapi-cache.spec
new file mode 100644
index 0000000..e9e1b7d
--- /dev/null
+++ b/python-fastapi-cache.spec
@@ -0,0 +1,276 @@
+%global _empty_manifest_terminate_build 0
+Name: python-fastapi-cache
+Version: 0.1.0
+Release: 1
+Summary: FastAPI simple cache
+License: MIT License
+URL: https://github.com/comeuplater/fastapi_cache
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/4d/f8/0cbd6a6ac2309bedff4f98a345d9629953afdf0dc25f7b2f2218384d881f/fastapi-cache-0.1.0.tar.gz
+BuildArch: noarch
+
+
+%description
+# FastAPI Cache
+
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2ec5c44e899943c8920d3c3e31616784)](https://app.codacy.com/manual/ivan.sushkov/fastapi_cache?utm_source=github.com&utm_medium=referral&utm_content=comeuplater/fastapi_cache&utm_campaign=Badge_Grade_Dashboard)
+[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
+[![PyPi Version](https://img.shields.io/pypi/v/fastapi-cache.svg)](https://pypi.python.org/pypi/fastapi-cache/)
+[![Downloads](https://pepy.tech/badge/fastapi-cache)](https://pepy.tech/project/fastapi-cache)
+[![Build Status](https://travis-ci.com/comeuplater/fastapi_cache.svg?branch=master)](https://travis-ci.com/comeuplater/fastapi_cache)
+
+Implements simple lightweight cache system as dependencies in FastAPI.
+
+## Installation
+
+```sh
+pip install fastapi-cache
+```
+
+## Usage example
+```python
+from fastapi import Depends, FastAPI
+
+from fastapi_cache import caches, close_caches
+from fastapi_cache.backends.redis import CACHE_KEY, RedisCacheBackend
+
+app = FastAPI()
+
+
+def redis_cache():
+ return caches.get(CACHE_KEY)
+
+
+@app.get('/')
+async def hello(
+ cache: RedisCacheBackend = Depends(redis_cache)
+):
+ in_cache = await cache.get('some_cached_key')
+ if not in_cache:
+ await cache.set('some_cached_key', 'new_value', 5)
+
+ return {'response': in_cache or 'default'}
+
+
+@app.on_event('startup')
+async def on_startup() -> None:
+ rc = RedisCacheBackend('redis://redis')
+ caches.set(CACHE_KEY, rc)
+
+
+@app.on_event('shutdown')
+async def on_shutdown() -> None:
+ await close_caches()
+```
+
+## TODO
+
+* [X] Add tests
+* [ ] ~~Add registry decorator~~
+* [ ] Add dependency for requests caching
+
+## Acknowledgments
+
+* [Balburdia](https://github.com/Balburdia)
+* [xobtoor](https://github.com/xobtoor)
+* [jersobh](https://github.com/jersobh)
+
+
+## Changelog
+
+* 0.0.6 Added typings for backends. Specific arguments now need to be passed through **kwargs.
+Set default encoding to utf-8 for redis backend, removed default TTL for redis keys.
+
+%package -n python3-fastapi-cache
+Summary: FastAPI simple cache
+Provides: python-fastapi-cache
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-fastapi-cache
+# FastAPI Cache
+
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2ec5c44e899943c8920d3c3e31616784)](https://app.codacy.com/manual/ivan.sushkov/fastapi_cache?utm_source=github.com&utm_medium=referral&utm_content=comeuplater/fastapi_cache&utm_campaign=Badge_Grade_Dashboard)
+[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
+[![PyPi Version](https://img.shields.io/pypi/v/fastapi-cache.svg)](https://pypi.python.org/pypi/fastapi-cache/)
+[![Downloads](https://pepy.tech/badge/fastapi-cache)](https://pepy.tech/project/fastapi-cache)
+[![Build Status](https://travis-ci.com/comeuplater/fastapi_cache.svg?branch=master)](https://travis-ci.com/comeuplater/fastapi_cache)
+
+Implements simple lightweight cache system as dependencies in FastAPI.
+
+## Installation
+
+```sh
+pip install fastapi-cache
+```
+
+## Usage example
+```python
+from fastapi import Depends, FastAPI
+
+from fastapi_cache import caches, close_caches
+from fastapi_cache.backends.redis import CACHE_KEY, RedisCacheBackend
+
+app = FastAPI()
+
+
+def redis_cache():
+ return caches.get(CACHE_KEY)
+
+
+@app.get('/')
+async def hello(
+ cache: RedisCacheBackend = Depends(redis_cache)
+):
+ in_cache = await cache.get('some_cached_key')
+ if not in_cache:
+ await cache.set('some_cached_key', 'new_value', 5)
+
+ return {'response': in_cache or 'default'}
+
+
+@app.on_event('startup')
+async def on_startup() -> None:
+ rc = RedisCacheBackend('redis://redis')
+ caches.set(CACHE_KEY, rc)
+
+
+@app.on_event('shutdown')
+async def on_shutdown() -> None:
+ await close_caches()
+```
+
+## TODO
+
+* [X] Add tests
+* [ ] ~~Add registry decorator~~
+* [ ] Add dependency for requests caching
+
+## Acknowledgments
+
+* [Balburdia](https://github.com/Balburdia)
+* [xobtoor](https://github.com/xobtoor)
+* [jersobh](https://github.com/jersobh)
+
+
+## Changelog
+
+* 0.0.6 Added typings for backends. Specific arguments now need to be passed through **kwargs.
+Set default encoding to utf-8 for redis backend, removed default TTL for redis keys.
+
+%package help
+Summary: Development documents and examples for fastapi-cache
+Provides: python3-fastapi-cache-doc
+%description help
+# FastAPI Cache
+
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2ec5c44e899943c8920d3c3e31616784)](https://app.codacy.com/manual/ivan.sushkov/fastapi_cache?utm_source=github.com&utm_medium=referral&utm_content=comeuplater/fastapi_cache&utm_campaign=Badge_Grade_Dashboard)
+[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
+[![PyPi Version](https://img.shields.io/pypi/v/fastapi-cache.svg)](https://pypi.python.org/pypi/fastapi-cache/)
+[![Downloads](https://pepy.tech/badge/fastapi-cache)](https://pepy.tech/project/fastapi-cache)
+[![Build Status](https://travis-ci.com/comeuplater/fastapi_cache.svg?branch=master)](https://travis-ci.com/comeuplater/fastapi_cache)
+
+Implements simple lightweight cache system as dependencies in FastAPI.
+
+## Installation
+
+```sh
+pip install fastapi-cache
+```
+
+## Usage example
+```python
+from fastapi import Depends, FastAPI
+
+from fastapi_cache import caches, close_caches
+from fastapi_cache.backends.redis import CACHE_KEY, RedisCacheBackend
+
+app = FastAPI()
+
+
+def redis_cache():
+ return caches.get(CACHE_KEY)
+
+
+@app.get('/')
+async def hello(
+ cache: RedisCacheBackend = Depends(redis_cache)
+):
+ in_cache = await cache.get('some_cached_key')
+ if not in_cache:
+ await cache.set('some_cached_key', 'new_value', 5)
+
+ return {'response': in_cache or 'default'}
+
+
+@app.on_event('startup')
+async def on_startup() -> None:
+ rc = RedisCacheBackend('redis://redis')
+ caches.set(CACHE_KEY, rc)
+
+
+@app.on_event('shutdown')
+async def on_shutdown() -> None:
+ await close_caches()
+```
+
+## TODO
+
+* [X] Add tests
+* [ ] ~~Add registry decorator~~
+* [ ] Add dependency for requests caching
+
+## Acknowledgments
+
+* [Balburdia](https://github.com/Balburdia)
+* [xobtoor](https://github.com/xobtoor)
+* [jersobh](https://github.com/jersobh)
+
+
+## Changelog
+
+* 0.0.6 Added typings for backends. Specific arguments now need to be passed through **kwargs.
+Set default encoding to utf-8 for redis backend, removed default TTL for redis keys.
+
+%prep
+%autosetup -n fastapi-cache-0.1.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-fastapi-cache -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..580a86d
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+ea8260fbcd2ec22aaf1f572f0f01b8d5 fastapi-cache-0.1.0.tar.gz