Comments (8)
This would be useful for use over the internet.
from cashews.
Oh yes, of course we should support redis with tls
If aioredis-py support rediss://
notation in uri it will be simple to add support for it.
Would you like to contribute?
from cashews.
Yeah, so I did just try adding a match in the client, but it's a bit more complex than that because you have to allow for stuff like this: rq/rq#1468 I'd be glad to contribute the simple change around matching the backend, but not sure how/if you'd like to expose those extra parameters.
from cashews.
I hope that it is not so complicated as you think, but I could be wrong 😅
We already can pass any parameters to the redis Connection class by setup
method:
from cashews import cache
from aioredis.connection import SSLConnection
cache.setup("redis://?ssl_keyfile=/tmp/test.key", connection_class=SSLConnection)
cache._backends[""][0]._client.connection_pool.connection_kwargs
# that is kwargs that will passed to a redis connection class https://github.com/aio-libs/aioredis-py/blob/56d6b325ee246a3eb0fc8bb6803247c86bb2f494/aioredis/connection.py
>>> {'ssl_keyfile': '/tmp/test.ssl', 'client_name': 'cashews', 'health_check_interval': 10, 'socket_keepalive': True, 'retry_on_timeout': False, 'socket_timeout': 0.1, 'decode_responses': False}
So maybe you can use redis over tls with code above, but I think that we should support rediss://
uri schema like aioredis do.
I hope that adding mapping to the settings_url_parse function will be enough, and using redis over tls will be look like:
from caches import cache
cache.setup("rediss://redis_host/1", ssl_cert_reqs=None)
# or
cache.setup("rediss://redis?ssl_ca_certs=/path/to/custom/ca-cert")
from cashews.
Ok @Krukov please see and review my very small feature, then.
from cashews.
Thanks @alcibiadeseth!
By the way, did you test it ? I am going to add it to the documentation, I want to be sure that its work )
from cashews.
I tested it in the sense that it picks up the prefix, but not your bit about how to pass the additional parameters.
from cashews.
Thanks you !
I have added documentation about rediss and released new version
from cashews.
Related Issues (20)
- Improve docs HOT 1
- Templated tags with None values throw TagNotRegisteredError HOT 1
- 'cache' is not declared in __all__ HOT 2
- Provision to skip caching immediately if not able to make connection with Redis HOT 4
- Not working with GCP MemmoryStore (Redis) - unknown command 'CLIENT' HOT 2
- Getting TagNotRegisteredError when my key have special characters (Using custom decorator) HOT 4
- Key template context
- TypeErrors when using CacheEtagMiddleware HOT 3
- Support for non async code ( synchronous )
- CacheEtagMiddleware breaks with redis client_side cache HOT 1
- Counter in Cache condition
- cache_control_ttl is undocumented HOT 1
- Documenting with sphinx? HOT 1
- ValueError: Duplicated timeseries in CollectorRegistry HOT 2
- early_ttl not working in combination with CacheEtagMiddleware HOT 5
- Gracefully close a connection pool with redis > 5.0.1
- Cannot close Redis connection - AttributeError: 'Redis' object has no attribute '_client' HOT 4
- Cache doesn't work with GZIPMiddleware HOT 5
- JSON serializer HOT 5
- Early cache with sqlalchemy & fastapi depend (sqlalchemy.exc.IllegalStateChangeError: Method 'close()' can't be called here; method '_connection_for_bind()' is already in progress and this would cause an unexpected state change to <SessionTransactionState.CLOSED: 5>) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cashews.