README.md in bmg-0.21.4 vs README.md in bmg-0.21.5
- old
+ new
@@ -195,19 +195,21 @@
```ruby
type = Bmg::Type::ANY.with_keys([[:id]])
r = Bmg.redis(type, {
key_prefix: "suppliers",
redis: Redis.new,
- serializer: :marshal
+ serializer: :marshal,
+ ttl: 365 * 24 * 60 * 60
})
```
-The key prefix will be used to distinguish the tuples from other
-elements in the same database (e.g. tuples from other relvars).
-The serializer is either `:marshal` or `:json`. Please note that
-types are not preserved when using the second one (all attribute
-values will come back as strings, but keys will be symbolized).
+The key prefix will be used to distinguish the tuples from other elements in the
+same database (e.g. tuples from other relvars). The serializer is either
+`:marshal` or `:json`. Please note that types are not preserved when using the
+second one (all attribute values will come back as strings, but keys will be
+symbolized). The `ttl` is used to set the validity period of a tuple in redis
+and is optional.
The redis relvars support basic algorithms for insert/update/delete.
No optimization is currently supported.
### Your own relations
@@ -250,12 +252,12 @@
r.extend(x: :y) # shortcut for r.extend(x: ->(t){ t[:y] })
r.exclude(predicate) # shortcut for restrict(!predicate)
r.group([:a, :b, ...], :x) # relation-valued attribute from attributes
r.image(right, :x, [:a, :b, ...]) # relation-valued attribute from another relation
r.images({:x => r1, :y => r2}, [:a, ...]) # shortcut over image(r1, :x, ...).image(r2, :y, ...)
-r.join(right, [:a, :b, ...]) # natural join on a join key
-r.join(right, :a => :x, :b => :y, ...) # natural join after right reversed renaming
+r.join(right, [:a, :b, ...]) # join on a join key
+r.join(right, :a => :x, :b => :y, ...) # join after right reversed renaming
r.left_join(right, [:a, :b, ...], {...}) # left join with optional default right tuple
r.left_join(right, {:a => :x, ...}, {...}) # left join after right reversed renaming
r.matching(right, [:a, :b, ...]) # semi join, aka where exists
r.matching(right, :a => :x, :b => :y, ...) # semi join, after right reversed renaming
r.not_matching(right, [:a, :b, ...]) # inverse semi join, aka where not exists
@@ -266,13 +268,13 @@
r.rename(a: :x, b: :y, ...) # rename some attributes
r.restrict(a: "foo", b: "bar", ...) # relational restriction, aka where
r.rxmatch([:a, :b, ...], /xxx/) # regex match kind of restriction
r.summarize([:a, :b, ...], x: :sum) # relational summarization
r.suffix(:_foo, but: [:a, ...]) # suffix kind of renaming
-t.transform(:to_s) # all-attrs transformation
-t.transform(&:to_s) # similar, but Proc-driven
-t.transform(:foo => :upcase, ...) # specific-attrs tranformation
-t.transform([:to_s, :upcase]) # chain-transformation
+r.transform(:to_s) # all-attrs transformation
+r.transform(&:to_s) # similar, but Proc-driven
+r.transform(:foo => :upcase, ...) # specific-attrs tranformation
+r.transform([:to_s, :upcase]) # chain-transformation
r.ungroup([:a, :b, ...]) # ungroup relation-valued attributes within parent tuple
r.ungroup(:a) # shortcut over ungroup([:a])
r.union(right) # relational union
r.unwrap([:a, :b, ...]) # merge tuple-valued attributes within parent tuple
r.unwrap(:a) # shortcut over unwrap([:a])