Sha256: 0e8772c030343ba3aaf8a8c3aeaa4ca54ba1836b3eeda24bd4343ec5e0cd7f41
Contents?: true
Size: 814 Bytes
Versions: 25
Compression:
Stored size: 814 Bytes
Contents
# frozen_string_literal: true require 'redis' module LinkedRails class Storage REDIS_DB = { cache: LinkedRails.cache_redis_database, persistent: LinkedRails.persistent_redis_database, stream: LinkedRails.stream_redis_database }.freeze KEYS = { manifest: 'cache:Manifest', redirect_exact: 'cache:Redirect:Exact', redirect_prefix: 'cache:Redirect:Prefix' }.freeze class << self %i[xadd].each do |method| define_method(method) do |db, *args| Redis.new(db: REDIS_DB.fetch(db)).send(method, *args) end end %i[hset hdel hget].each do |method| define_method(method) do |db, key, *args| Redis.new(db: REDIS_DB.fetch(db)).send(method, KEYS.fetch(key), *args) end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems