Commit Graph

207 Commits

Author SHA1 Message Date
Martijn Pieters
832650347b Attach updated endpoint signature to inner
Not all endpoints accept a __signature__ attribute, nor should the
cache decorator modify the decorated endpoint. Attach the signature
to the returned inner function instead.

While here, refactor the signature updating code, and extract it to
a separate function.
2023-04-27 18:14:59 +01:00
Martijn Pieters
72c42325ab The backend needs an async redis client with a pipeline method
The Abstract* classes lack the pipeline method so are not sufficient.
2023-04-27 16:33:43 +01:00
Martijn Pieters
6af14be049 Provide annotation for the session attribute 2023-04-27 16:32:07 +01:00
Martijn Pieters
9c966286b4 Use complete type hints with all generic parameters filled
This makes the core fastapi_cache pass all strict type checker tests.
2023-04-27 16:31:42 +01:00
Martijn Pieters
a52f6b1406 Simplify key_builder calling
The keybuilder is either returning a string, or a coroutine or other
awaitable. If the latter, await on the return value to get the string.
2023-04-27 16:29:10 +01:00
Martijn Pieters
255f40117b Define keybuilder protocol
This lets others create key builders that are type checked fully.
2023-04-27 16:26:41 +01:00
Martijn Pieters
d4cd787527 JSONResponse.body is UTF-8 bytes and must be decoded 2023-04-27 16:20:12 +01:00
Martijn Pieters
059793d585 Remove a type: ignore comment
GIve the type checker more information about the converters instead.
2023-04-27 16:19:02 +01:00
Martijn Pieters
0d0fe1f0d0 Mark up the class variables as such
There is never an instance of this class, so these are not instance attributes.
2023-04-27 16:15:06 +01:00
Martijn Pieters
32acafa5e0 Correct type hint: namespace is not optional
The namespace argument is positional and will never be `None` so should
not be marked as Optional. It is always a string, and the default is
to pass in an empty string.
2023-04-27 16:11:59 +01:00
long2ice
ee58f979d4 ci: fix workflows 2023-02-15 10:53:24 +08:00
long2ice
38ddd063c3 test: add httpx for test 2023-02-15 10:49:35 +08:00
long2ice
27acce3160 ci: fix poetry 2023-02-15 10:45:19 +08:00
long2ice
d04be274e9 feat: upgrade deps v0.2.1 2023-02-15 10:43:01 +08:00
long2ice
80563fd6e7 Merge pull request #118 from naoki-jarvisml/var_keyword
Support functions with VAR_KEYWORD parameter
2023-02-15 10:30:12 +08:00
Naoki Shima
98cf8a78a1 adding test coverage 2023-02-15 10:35:41 +09:00
Naoki Shima
01c895dbbb Support functions with VAR_KEYWORD parameter
decorating function with **kwargs parameter with @cache causes ValueError.

ValueError: wrong parameter order: variadic keyword parameter before keyword-only parameter

We need to inject request / response parameters before VAR_KEYWORD parameter.
2023-02-09 15:14:20 +09:00
long2ice
e3b08dda2c Merge pull request #114 from hackjammer/feature/redisCluster
Add RedisCluster Support
2023-02-01 15:33:11 +08:00
long2ice
552a7695e8 Update fastapi_cache/decorator.py
Co-authored-by: mkdir700 <56359329+mkdir700@users.noreply.github.com>
2023-02-01 15:33:04 +08:00
hackjammer
ea1ffcd7b4 Add logging to decorator.py on backend failures 2023-01-17 12:15:53 +00:00
hackjammer
e8193b5c22 enabled redis in cluster mode 2023-01-15 21:54:16 +00:00
hackjammer
ab26fad604 passthrough for any type of backend exception 2023-01-15 17:07:37 +00:00
long2ice
7a89f28b54 Merge pull request #112 from schmocker/main
add cache-control and etag to header of fist response
2023-01-15 12:27:56 +08:00
Tobias Schmocker
334b829a80 Merge branch 'master'
# Conflicts:
#	fastapi_cache/decorator.py
2023-01-14 19:11:42 +01:00
long2ice
62ef8bed37 Merge pull request #109 from Mrreadiness/fix/piclke-coder
Fix Piclke Coder
2023-01-11 21:31:02 +08:00
Ivan Moiseev
9a39db7a73 Merge branch 'long2ice:main' into fix/piclke-coder 2023-01-11 16:26:05 +03:00
long2ice
59a47b7fae chore: set version 0.2.0 v0.2.0 2023-01-11 21:20:41 +08:00
long2ice
09361a7d4f Merge pull request #98 from vvanglro/feat/cache_response_obj
Feat/cache response obj
2023-01-11 17:23:47 +08:00
vvanglro
ed101595f7 fix: merge master 2023-01-11 16:43:36 +08:00
long2ice
0c73777930 Merge pull request #108 from hackjammer/master
Transparent passthrough in the event of cache backend connection issues
2023-01-11 10:45:11 +08:00
vvanglro
0d964fcf9f fix: remove unused 2023-01-07 13:55:41 +08:00
vvanglro
614ee25d0d feat: merge master 2023-01-07 13:46:48 +08:00
hackjammer
b420f26e9b transparent passthrough in the event of backend connection issues 2023-01-05 18:44:40 +00:00
Ivan Moiseev
e23289fcbf Merge branch 'main' into fix/piclke-coder 2022-12-08 00:23:39 +04:00
long2ice
8f0920d0d7 ci: fix 2022-11-07 16:39:17 +08:00
long2ice
91e6e51ec7 Merge pull request #101 from mkdir700/fix-ci-errors-on-python3.11
Fix ci errors on python3.11
2022-11-07 16:33:45 +08:00
mkdir700
5c776d20db build: update version of aiohttp 2022-11-05 22:21:35 +08:00
mkdir700
c4ae7154fd ci: update version of actions 2022-11-05 22:21:35 +08:00
Ivan Moiseev
cb9fe5c065 fix: PickleCoder and add tests for it. 2022-11-05 13:45:16 +04:00
vvanglro
c1484a46fd feat: CHANGELOG.md 2022-11-04 17:44:41 +08:00
vvanglro
2710129c4e feat: cache response obj add test case 2022-11-04 17:34:20 +08:00
vvanglro
4cb4afeff0 feat: support cache JSONResponse 2022-11-04 17:31:37 +08:00
vvanglro
a8fbf2b340 fix: request / router KeyError 2022-11-04 16:56:43 +08:00
long2ice
73f000a565 Merge pull request #93 from Mrreadiness/feat/type-hints-covering
Feat/type hints covering
2022-11-04 08:51:21 +08:00
long2ice
cda720f534 Merge pull request #74 from Genius-Voice/feature/support-async-keybuilder
Add ability to use async function for key_builder
2022-11-03 20:25:27 +08:00
Ivan Moiseev
5881bb9122 Merge branch 'main' into feat/type-hints-covering
# Conflicts:
#	fastapi_cache/coder.py
#	fastapi_cache/decorator.py
2022-11-03 15:53:22 +04:00
Ivan Moiseev
10f819483c fix: replace pipe for Optional 2022-11-03 15:49:58 +04:00
long2ice
566d30b790 Merge pull request #88 from vvanglro/feat/cache_html
feat: support cache jinja2 template response
2022-11-03 19:42:47 +08:00
long2ice
671af52aea Merge pull request #33 from DevLucca/master
add `no-cache` to cache exclusion
2022-10-31 21:51:35 +08:00
Ivan Moiseev
71a77f6b39 fix: request and response type hints 2022-10-30 11:03:16 +04:00