Skip to content

Commit

Permalink
Various documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwight Hubbard committed May 7, 2015
1 parent 5bde83d commit c6a5ef1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Self contained Python interface to the Redis key-value store.
It makes it possible to use Redis without the need to install and configure
a redis server.


Requirements
------------
The redislite module requires Python 2.7 or higher.
Expand Down
5 changes: 3 additions & 2 deletions docs/source/topic/redislite_design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ filename to use for the redis rdb file.
These enhanced classes provide the following additional functionality:

* They configure and start an embedded copy of the redis server running on a unix domain socket in the redislite temp directory for the communication to the redis service.
* TCP communication is disabled.
* TCP communication is disabled, unless server settings are passed to enable it.
* The classes have two additional attributes:
* db - The path to the db backing file for the redis instance.
* pid - The process id (pid) of the embedded redis server.
* If the db argument is passed and there is another redislite object using that db, it will create a new connection to that redislite instance.
* The redis server for a redislite object is shutdown and it's configuration is deleted when the object is cleaned up.
* The redis server for a redislite object is shutdown and it's configuration is deleted when the last redislite connection to the server is terminated.
* If a redis rdb filename is specified, the cleanup will not delete the rdb file so it can be used again.
3 changes: 3 additions & 0 deletions docs/source/topic/troubleshooting.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Troubleshooting redislite
=========================

Installation Issues
-------------------


14 changes: 9 additions & 5 deletions docs/source/topic/using_with_existing_modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,20 @@ Note that only one Redis instance is created, and others merely discover the run

redis-collections
-----------------
Here is how to patch the redis_collections module to use redislite
Use a redisliste.StrictRedis() object for the redis-collections redis keyword
argument to use it with redislite. If the redis-collection variable needs to
be persistent make sure to pass the redislite.StrictRedis() class a dbfilename
argument to use.

.. code-block:: python
>>> import redislite
>>> import redis_collections
>>> td = redis_collections.Dict(redis=redislite.StrictRedis())
>>> td['foo']='bar'
>>> td.keys()
['foo']
>>> example_dict = redis_collections.Dict(redis=redislite.StrictRedis('example.rdb'))
>>> example_dict['test'] = 'This is a test variable'
>>> example_dict
<redis_collections.Dict at 7908fc2cc97d49fda4bce7365df3b373 {'test': 'This is a test variable'}>
>>>
RQ
Expand Down
6 changes: 2 additions & 4 deletions tests/test_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
# noinspection PyPep8Naming
class TestRedisliteSlave(unittest.TestCase):

def setUp(self):
def test_slave(self):
self.master = redislite.Redis(serverconfig={'port': '7000'})
self.master.set('key', 'value')

def test_slave(self):
s = redislite.Redis(serverconfig={'slaveof': 'localhost 7000'})
time.sleep(.5)
s = redislite.Redis(serverconfig={'slaveof': 'localhost 7000'})
value = s.get('key').decode(encoding='UTF-8')
self.assertEquals(value, 'value')

0 comments on commit c6a5ef1

Please sign in to comment.