Module: Kredis::Types

Included in:
Kredis
Defined in:
lib/kredis/types.rb

Defined Under Namespace

Classes: CallbacksProxy, Counter, Cycle, Enum, Flag, Hash, Limiter, List, OrderedSet, Proxy, Proxying, Scalar, Set, Slots, UniqueList

Instance Method Summary collapse

Instance Method Details

#boolean(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



31
32
33
# File 'lib/kredis/types.rb', line 31

def boolean(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :boolean, default: default, expires_in: expires_in)
end

#counter(key, expires_in: nil, default: nil, config: :shared, after_change: nil) ⇒ Object



44
45
46
# File 'lib/kredis/types.rb', line 44

def counter(key, expires_in: nil, default: nil, config: :shared, after_change: nil)
  type_from(Counter, config, key, after_change: after_change, default: default, expires_in: expires_in)
end

#cycle(key, values:, expires_in: nil, config: :shared, after_change: nil) ⇒ Object



48
49
50
# File 'lib/kredis/types.rb', line 48

def cycle(key, values:, expires_in: nil, config: :shared, after_change: nil)
  type_from(Cycle, config, key, after_change: after_change, values: values, expires_in: expires_in)
end

#datetime(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



35
36
37
# File 'lib/kredis/types.rb', line 35

def datetime(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :datetime, default: default, expires_in: expires_in)
end

#decimal(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



23
24
25
# File 'lib/kredis/types.rb', line 23

def decimal(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :decimal, default: default, expires_in: expires_in)
end

#enum(key, values:, default:, config: :shared, after_change: nil) ⇒ Object



56
57
58
# File 'lib/kredis/types.rb', line 56

def enum(key, values:, default:, config: :shared, after_change: nil)
  type_from(Enum, config, key, after_change: after_change, values: values, default: default)
end

#flag(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



52
53
54
# File 'lib/kredis/types.rb', line 52

def flag(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Flag, config, key, after_change: after_change, default: default, expires_in: expires_in)
end

#float(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



27
28
29
# File 'lib/kredis/types.rb', line 27

def float(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :float, default: default, expires_in: expires_in)
end

#hash(key, typed: :string, default: nil, config: :shared, after_change: nil) ⇒ Object



60
61
62
# File 'lib/kredis/types.rb', line 60

def hash(key, typed: :string, default: nil, config: :shared, after_change: nil)
  type_from(Hash, config, key, after_change: after_change, default: default, typed: typed)
end

#integer(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



19
20
21
# File 'lib/kredis/types.rb', line 19

def integer(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :integer, default: default, expires_in: expires_in)
end

#json(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



39
40
41
# File 'lib/kredis/types.rb', line 39

def json(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :json, default: default, expires_in: expires_in)
end

#limiter(key, limit:, expires_in: nil, config: :shared, after_change: nil) ⇒ Object



88
89
90
# File 'lib/kredis/types.rb', line 88

def limiter(key, limit:, expires_in: nil, config: :shared, after_change: nil)
  type_from(Limiter, config, key, after_change: after_change, expires_in: expires_in, limit: limit)
end

#list(key, default: nil, typed: :string, config: :shared, after_change: nil) ⇒ Object



64
65
66
# File 'lib/kredis/types.rb', line 64

def list(key, default: nil, typed: :string, config: :shared, after_change: nil)
  type_from(List, config, key, after_change: after_change, default: default, typed: typed)
end

#ordered_set(key, default: nil, typed: :string, limit: nil, config: :shared, after_change: nil) ⇒ Object



76
77
78
# File 'lib/kredis/types.rb', line 76

def ordered_set(key, default: nil, typed: :string, limit: nil, config: :shared, after_change: nil)
  type_from(OrderedSet, config, key, after_change: after_change, default: default, typed: typed, limit: limit)
end

#proxy(key, config: :shared, after_change: nil) ⇒ Object



6
7
8
# File 'lib/kredis/types.rb', line 6

def proxy(key, config: :shared, after_change: nil)
  type_from(Proxy, config, key, after_change: after_change)
end

#scalar(key, typed: :string, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



11
12
13
# File 'lib/kredis/types.rb', line 11

def scalar(key, typed: :string, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: typed, default: default, expires_in: expires_in)
end

#set(key, default: nil, typed: :string, config: :shared, after_change: nil) ⇒ Object



72
73
74
# File 'lib/kredis/types.rb', line 72

def set(key, default: nil, typed: :string, config: :shared, after_change: nil)
  type_from(Set, config, key, after_change: after_change, default: default, typed: typed)
end

#slot(key, config: :shared, after_change: nil) ⇒ Object



80
81
82
# File 'lib/kredis/types.rb', line 80

def slot(key, config: :shared, after_change: nil)
  type_from(Slots, config, key, after_change: after_change, available: 1)
end

#slots(key, available:, config: :shared, after_change: nil) ⇒ Object



84
85
86
# File 'lib/kredis/types.rb', line 84

def slots(key, available:, config: :shared, after_change: nil)
  type_from(Slots, config, key, after_change: after_change, available: available)
end

#string(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object



15
16
17
# File 'lib/kredis/types.rb', line 15

def string(key, default: nil, config: :shared, after_change: nil, expires_in: nil)
  type_from(Scalar, config, key, after_change: after_change, typed: :string, default: default, expires_in: expires_in)
end

#unique_list(key, default: nil, typed: :string, limit: nil, config: :shared, after_change: nil) ⇒ Object



68
69
70
# File 'lib/kredis/types.rb', line 68

def unique_list(key, default: nil, typed: :string, limit: nil, config: :shared, after_change: nil)
  type_from(UniqueList, config, key, after_change: after_change, default: default, typed: typed, limit: limit)
end