README.md in redis_token-0.0.4 vs README.md in redis_token-0.0.5
- old
+ new
@@ -92,10 +92,14 @@
# => "548a5d54eaf474c750bf83ed04bd242a"
# Create token with payload:
mobile_token = r.create("c.#{client.id}", payload: { source: :native })
# => "865249d6b87c4e6dd8f6b0796ace7fa0"
+
+# Save exist token:
+r.create('api', token: SecureRandom.uuid)
+# => "aed6e179-14b4-4a8c-9a1b-6b0f9150ede3"
```
### Get token
```ruby
@@ -137,6 +141,29 @@
### Delete all tokens of an owner
```ruby
r.delete_all('client.1')
# => 8
+```
+
+### Serialization
+
+redis_token uses native Marshal class for data serialization by default. You can override it like this:
+
+```ruby
+require 'msgpack'
+
+class MsgPackSerializer
+ def pack(value)
+ MessagePack.pack(value)
+ end
+
+ def unpack(value)
+ MessagePack.unpack(value)
+ end
+end
+
+r = RedisToken.new(prefix: PREFIX, serializer_class: MsgPackSerializer)
+# Or
+r = RedisToken.new(prefix: PREFIX)
+r.use(MsgPackSerializer)
```