keep record id sync with dynamic redis set or zset
add gem 'rediscord'
to Gemfile, and run bundle install
include Rediscord redis_set key: ->(m){ "level_#{m.level}_post_set" }, redis: Redis.new end
```ruby
Post.create(level: :one) # id: 1
Post.create(level: :one) # id: 2
Post.create(level: :two) # id: 3
Post.create(level: :there) # id: 4
what's in redis?
class Post < ApplicationRecord
enum level: [ :one, :two, :there ]
include Rediscord
redis_zset key: ->(m){ "level_#{m.level}_post_zset" }, score: ->(m){ m.updated_at.to_i }, redis: Redis.new
end
Post.create(level: :one)
Post.create(level: :one)
Post.create(level: :two)
Post.create(level: :there)