ohm 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ecea4a8e9a9d11936a4dd250c91171ae3a47530
4
- data.tar.gz: ad07199ffc7506ab69d7193d439cbd5373e41cac
3
+ metadata.gz: dcac01f4679b94c4e17d2ee417f59887a8a41f62
4
+ data.tar.gz: 5fba56af15af361a22fd0cd6df37adf9bc9beaf3
5
5
  SHA512:
6
- metadata.gz: b36d7473878642e18e827de61079b5fd36f083abba8aea39265927f0ad2370b1702bab376b37297d3b0bbb8d487ada008c6f98818cd82de84d9d4698405ec21e
7
- data.tar.gz: 8ad17db1d2c0e6d9c4a2c661a75dac9b571cca89f7b542751826852512406a6aebeca58c38838ceb69904920fc63e08be55ab696d34618f23536237d7da7be0c
6
+ metadata.gz: c011955d15f026470d4af58e1b4d96be6b685bee79aa3b85247640bc700268d80fb7ed3f258ac2055fea7fc0ff8bd2dd4b07869b466b5cd89acbfa03143c8bee
7
+ data.tar.gz: 7e7ed6334f0db7446262362a49540cee4bbce18ff1163992854dd6faac6cb7f99147f1b753552fdf4aa4ff84dbd678fb8b9ba19951a0ef4b7f640b2eaa35b857
@@ -1,3 +1,7 @@
1
+ ## 3.0.1
2
+
3
+ - Adapt Lua scripts to Redis unstable.
4
+
1
5
  ## 3.0.0
2
6
 
3
7
  - Use JSON instead of msgpack for internal encoding.
data/README.md CHANGED
@@ -222,6 +222,41 @@ containing the foreign key to another model.
222
222
 
223
223
  Provides an accessor to search for all models that `reference` the current model.
224
224
 
225
+ Tracked keys
226
+ ------------
227
+
228
+ Besides the provided attribute types, it is possible to instruct
229
+ Ohm to track arbitrary keys and tie them to the object's lifecycle.
230
+
231
+ For example:
232
+
233
+ ```ruby
234
+ class Log < Ohm::Model
235
+ track :text
236
+
237
+ def append(msg)
238
+ redis.call("APPEND", key[:text], msg)
239
+ end
240
+
241
+ def tail(n = 100)
242
+ redis.call("GETRANGE", key[:text], -(n), -1)
243
+ end
244
+ end
245
+
246
+ log = Log.create
247
+ log.append("hello\n")
248
+
249
+ assert_equal "hello\n", log.tail
250
+
251
+ log.append("world\n")
252
+
253
+ assert_equal "world\n", log.tail(6)
254
+ ```
255
+
256
+ When the `log` object is deleted, the `:text` key will be deleted
257
+ too. Note that the key is scoped to that particular instance of
258
+ `Log`, so if `log.id` is `42` then the key will be `Log:42:text`.
259
+
225
260
  Persistence strategy
226
261
  --------------------
227
262
 
@@ -78,9 +78,10 @@ end
78
78
  local function unique(model, uniques)
79
79
  for field, value in pairs(uniques) do
80
80
  local key = model.name .. ":uniques:" .. field
81
+ local val = tostring(value)
81
82
 
82
- redis.call("HSET", model.key .. ":_uniques", key, value)
83
- redis.call("HSET", key, value, model.id)
83
+ redis.call("HSET", model.key .. ":_uniques", key, val)
84
+ redis.call("HSET", key, val, model.id)
84
85
  end
85
86
  end
86
87
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ohm"
3
- s.version = "3.0.0"
3
+ s.version = "3.0.1"
4
4
  s.summary = %{Object-hash mapping library for Redis.}
5
5
  s.description = %Q{Ohm is a library that allows to store an object in Redis, a persistent key-value database. It has very good performance.}
6
6
  s.authors = ["Michel Martens", "Damian Janowski", "Cyril David"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-04-13 00:00:00.000000000 Z
13
+ date: 2016-04-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: redic