Commits

Tomasz Rybarczyk committed 2774329

Improve docs formating

  • Participants
  • Parent commits 33f96a1

Comments (0)

Files changed (1)

 
 * you have to explicite overwrite value in RedisDict instance:
 
-
-    >>> import redis_dict, redis
-    >>> connection = redis.Redis()
-    >>> rd = redis_dict.RedisDict('new-dict', connection)
-    >>> rd['a'] = {'key': 'value'}
-    >>> a = rd['a']
-    >>> # this call doesn't affects redis state
-    >>> a['key'] = 'new value'
-    >>> print rd['a']['key']
-    value
-    >>> # you have to explicite override
-    >>> rd['a'] = a
-    >>> print rd['a']['key']
-    new value
-
+        >>> import redis_dict, redis
+        >>> connection = redis.Redis()
+        >>> rd = redis_dict.RedisDict('new-dict', connection)
+        >>> rd['a'] = {'key': 'value'}
+        >>> a = rd['a']
+        >>> # this call doesn't affects redis state
+        >>> a['key'] = 'new value'
+        >>> print rd['a']['key']
+        value
+        >>> # you have to explicite override
+        >>> rd['a'] = a
+        >>> print rd['a']['key']
+        new value
 
 * such an update is not atomic operation - prefered way to do it is to use `execute_update` method which uses redis transactions (`WATCH` and `MULTI`) to ensure atomicity of operation:
 
-
-    >>> import redis_dict, redis
-    >>> connection = redis.Redis()
-    >>> rd = redis_dict.RedisDict('new-dict', connection)
-    >>> rd['a'] = {'key': 'value'}
-    >>> # updater receives current value and should return new value
-    >>> rd.execute_update('a', lambda curr_value: dict(curr_value, key='new value'))
-    >>> print rd['a']['key']
-    new value
+        >>> import redis_dict, redis
+        >>> connection = redis.Redis()
+        >>> rd = redis_dict.RedisDict('new-dict', connection)
+        >>> rd['a'] = {'key': 'value'}
+        >>> # updater receives current value and should return new value
+        >>> rd.execute_update('a', lambda curr_value: dict(curr_value, key='new value'))
+        >>> print rd['a']['key']
+        new value