module Relix

Constants

REDIS_VERSION
VERSION

Public Class Methods

db=(value) click to toggle source
# File lib/relix/redis.rb, line 34
def self.db=(value)
  @redis_db = value
end
default_keyer(keyer=nil, options={}) click to toggle source
# File lib/relix/keyer.rb, line 2
def self.default_keyer(keyer=nil, options={})
  if keyer
    @default_keyer ||= [keyer, options]
  else
    @default_keyer
  end
end
deprecate(message, as_of_version) click to toggle source
# File lib/relix/version.rb, line 31
def self.deprecate(message, as_of_version)
  as_of_version = Version.new(as_of_version)

  if Version.new(VERSION).major > as_of_version.major
    raise DeprecationError.new(message)
  else
    $stderr.puts(message)
  end
end
host=(value) click to toggle source
# File lib/relix/redis.rb, line 26
def self.host=(value)
  @redis_host = value
end
included(klass) click to toggle source
Calls superclass method
# File lib/relix/core.rb, line 2
def self.included(klass)
  super
  klass.extend ClassMethods
end
index_types() click to toggle source
# File lib/relix/core.rb, line 7
def self.index_types
  @index_types ||= {}
end
new_redis_client() click to toggle source
# File lib/relix/redis.rb, line 16
def self.new_redis_client
  ::Redis.new(host: @redis_host, port: @redis_port).tap do |client|
    version = client.info["redis_version"]
    if(Relix::Version.new(version) < Relix::REDIS_VERSION)
      raise UnsupportedRedisVersion.new("Relix requires Redis >= #{Relix::REDIS_VERSION}; you have #{version}.")
    end
    client.select @redis_db if @redis_db
  end
end
port=(value) click to toggle source
# File lib/relix/redis.rb, line 30
def self.port=(value)
  @redis_port = value
end
redis() { |redis| ... } click to toggle source
# File lib/relix/redis.rb, line 5
def self.redis
  unless @redis
    @redis = new_redis_client
  end
  if block_given?
    yield(@redis)
  else
    @redis
  end
end
register_index(index) click to toggle source
# File lib/relix/core.rb, line 11
def self.register_index(index)
  index_types[index.kind.to_sym] = index
end

Public Instance Methods

deindex!() click to toggle source
# File lib/relix/core.rb, line 46
def deindex!
  relix.deindex!(self)
end
index!() click to toggle source
# File lib/relix/core.rb, line 42
def index!
  relix.index!(self)
end
relix() click to toggle source
# File lib/relix/core.rb, line 38
def relix
  self.class.relix
end