Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
Django-Redis-Cache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared
Django-Redis-Cache
Commits
9156189f
Commit
9156189f
authored
Jul 20, 2015
by
Sean Bleier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding SOCKET_CONNECT_TIMEOUT option.
parent
fb26ad82
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
Makefile
Makefile
+1
-1
base.py
redis_cache/backends/base.py
+12
-2
connection.py
redis_cache/connection.py
+2
-0
No files found.
Makefile
View file @
9156189f
...
...
@@ -21,7 +21,7 @@ clean:
.PHONY
:
test
test
:
install_requirements
PYTHONPATH
=
$(PYTHONPATH)
: django-admin.py
test
--settings
=
tests.settings
-s
PYTHONPATH
=
$(PYTHONPATH)
: django-admin.py
test
tests.testapp.tests.socket_timeout_tests:SocketConnectTimeoutTestCase
--settings
=
tests.settings
-s
.PHONY
:
shell
shell
:
...
...
redis_cache/backends/base.py
View file @
9156189f
...
...
@@ -57,6 +57,7 @@ class BaseRedisCache(BaseCache):
self
.
parser_class
=
self
.
get_parser_class
()
self
.
pickle_version
=
self
.
get_pickle_version
()
self
.
socket_timeout
=
self
.
get_socket_timeout
()
self
.
socket_connect_timeout
=
self
.
get_socket_connect_timeout
()
self
.
connection_pool_class
=
self
.
get_connection_pool_class
()
self
.
connection_pool_class_kwargs
=
(
self
.
get_connection_pool_class_kwargs
()
...
...
@@ -106,13 +107,21 @@ class BaseRedisCache(BaseCache):
try
:
return
int
(
_pickle_version
)
except
(
ValueError
,
TypeError
):
raise
ImproperlyConfigured
(
"pickle version value must be an integer"
)
raise
ImproperlyConfigured
(
"pickle version value must be an integer"
)
def
get_socket_timeout
(
self
):
return
self
.
options
.
get
(
'SOCKET_TIMEOUT'
,
None
)
def
get_socket_connect_timeout
(
self
):
return
self
.
options
.
get
(
'SOCKET_CONNECT_TIMEOUT'
,
None
)
def
get_connection_pool_class
(
self
):
pool_class
=
self
.
options
.
get
(
'CONNECTION_POOL_CLASS'
,
'redis.ConnectionPool'
)
pool_class
=
self
.
options
.
get
(
'CONNECTION_POOL_CLASS'
,
'redis.ConnectionPool'
)
return
import_class
(
pool_class
)
def
get_connection_pool_class_kwargs
(
self
):
...
...
@@ -160,6 +169,7 @@ class BaseRedisCache(BaseCache):
db
=
self
.
db
,
password
=
self
.
password
,
socket_timeout
=
self
.
socket_timeout
,
socket_connect_timeout
=
self
.
socket_connect_timeout
,
)
client
=
redis
.
Redis
(
**
kwargs
)
kwargs
.
update
(
...
...
redis_cache/connection.py
View file @
9156189f
...
...
@@ -31,6 +31,7 @@ class CacheConnectionPool(object):
connection_pool_class
=
None
,
connection_pool_class_kwargs
=
None
,
socket_timeout
=
None
,
socket_connect_timeout
=
None
,
**
kwargs
):
connection_identifier
=
(
host
,
port
,
db
,
unix_socket_path
)
...
...
@@ -50,6 +51,7 @@ class CacheConnectionPool(object):
'connection_class'
:
connection_class
,
'parser_class'
:
parser_class
,
'socket_timeout'
:
socket_timeout
,
'socket_connect_timeout'
:
socket_connect_timeout
,
}
kwargs
.
update
(
connection_pool_class_kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment