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
152afe02
Commit
152afe02
authored
Jul 24, 2015
by
Sean Bleier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs to show default values and primary/secondary configuration setup.
parent
43da41b0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
3 deletions
+54
-3
advanced_configuration.rst
docs/advanced_configuration.rst
+54
-3
No files found.
docs/advanced_configuration.rst
View file @
152afe02
...
...
@@ -29,6 +29,8 @@ single redis server or several redis servers setup in a primary/secondary
configuration. The primary is used for writing and secondaries are
replicated versions of the primary for read-access.
**Default Backend:** ``redis_cache.RedisCache``
.. code:: python
# Unified keyspace
...
...
@@ -74,6 +76,8 @@ The ``DB`` option will allow key/values to exist in a different keyspace. The
``DB`` value can either be defined in the ``OPTIONS`` or in the ``LOCATION``
scheme.
**Default DB:** ``1``
.. code:: python
CACHES = {
...
...
@@ -106,8 +110,36 @@ option.
}
Pluggable Parse Classes
-----------------------
Master/Slave Setup
------------------
It's possible to have multiple redis servers in a master/slave or
primary/secondary configuration. Here we have the primary server acting as a
read/write server and secondary servers as read-only.
.. code:: python
CACHES = {
'default': {
'LOCATION': [
'127.0.0.1:6379', # Primary
'127.0.0.1:6380', # Secondary
'127.0.0.1:6381', # Secondary
],
'OPTIONS': {
'PASSWORD': 'yadayada',
'MASTER_CACHE': '127.0.0.1:6379',
...
},
...
}
}
Pluggable Parser Classes
------------------------
`redis-py`_ comes with two parsers: ``HiredisParser`` and ``PythonParser``.
The former uses the `hiredis`_ library to parse responses from the redis
...
...
@@ -115,7 +147,10 @@ server, while the latter uses Python. Hiredis is a library that uses C, so it
is much faster than the python parser, but requires installing the library
separately.
To install `hiredis`_:
**Default Parser:** ``redis.connection.PythonParser``
The default parser is the Python parser because there is no other dependency,
but I would recommend using `hiredis`_:
``pip install hiredis``
...
...
@@ -139,6 +174,12 @@ Pickle Version
When using the pickle serializer, you can use ``PICKLE_VERSION`` to specify
the protocol version of pickle you want to use to serialize your python objects.
**Default Pickle Version:** `-1`
The default pickle protocol is -1, which is the highest and latest version.
This value should be pinned to a specific protocol number, since ``-1`` means
different things between versions of Python.
.. code:: python
CACHES = {
...
...
@@ -165,6 +206,10 @@ If provided, the socket will time out when the established connection exceeds
Similarly, the socket will time out if it takes more than
``SOCKET_CONNECT_TIMEOUT`` seconds to establish.
**Default Socket Timeout:** ``None``
**Default Socket Connect Timeout:** ``None``
.. code:: python
CACHES={
...
...
@@ -191,6 +236,8 @@ connection pool. In addition, you can provide custom keyword arguments using
the ``CONNECTION_POOL_CLASS_KWARGS`` option that will be passed into the class
when it's initialized.
**Default Connection Pool:** ``redis.ConnectionPool``
.. code:: python
CACHES = {
...
...
@@ -223,6 +270,7 @@ are serializer using json, msgpack, and yaml. Not all serializers can handle
Python objects, so they are limited to primitive data types.
**Default Serializer:** ``redis_cache.serializers.PickleSerializer``
.. code:: python
...
...
@@ -251,6 +299,9 @@ The default compressor is ``NoopCompressor`` which does not compress your data.
However, if you want to compress your data, you can use one of the included
compressor classes:
**Default Compressor:** ``redis_cache.compressors.NoopCompressor``
.. code:: python
# zlib compressor
...
...
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