diff options
author | Nicholas Charriere <nicholascharriere@gmail.com> | 2017-11-15 10:06:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-15 10:06:29 -0800 |
commit | d59c1b470eb846d960a798bca4c94f79279e18b4 (patch) | |
tree | 1b01f152a2acbfba623ff719caee1ad178f6f562 | |
parent | ceefaadf4463f5e264ab68563d94df66ce4bf409 (diff) | |
parent | d8c60e10a99bcb91694231f9c3b8a7e9d8f90f31 (diff) | |
download | pymemcache-d59c1b470eb846d960a798bca4c94f79279e18b4.tar.gz |
Merge pull request #168 from gs230937207/patch-1
Update getting_started.rst
-rw-r--r-- | docs/getting_started.rst | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 6e1b8d7..9b0e111 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -30,7 +30,6 @@ on if a server goes down. client.set('some_key', 'some value') result = client.get('some_key') - Serialization -------------- @@ -56,6 +55,17 @@ Serialization client.set('key', {'a':'b', 'c':'d'}) result = client.get('key') +Deserialization with python3 +---------------------------- + +.. code-block:: python + + def json_deserializer(key, value, flags): + if flags == 1: + return value.decode('utf-8') + if flags == 2: + return json.loads(value.decode('utf-8')) + raise Exception("Unknown serialization format") Key Constraints --------------- @@ -69,7 +79,6 @@ set `allow_unicode_keys` to support unicode keys, but beware of what unicode encoding you use to make sure multiple clients can find the same key. - Best Practices --------------- |