Module: Kredis::Types
- Included in:
- Kredis
- Defined in:
- lib/kredis/types.rb
Defined Under Namespace
Classes: CallbacksProxy, Counter, Cycle, Enum, Flag, Hash, List, Proxy, Proxying, Scalar, Set, Slots, UniqueList
Instance Method Summary
collapse
-
#boolean(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#counter(key, expires_in: nil, config: :shared, after_change: nil) ⇒ Object
-
#cycle(key, values:, expires_in: nil, config: :shared, after_change: nil) ⇒ Object
-
#datetime(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#decimal(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#enum(key, values:, default:, config: :shared, after_change: nil) ⇒ Object
-
#flag(key, config: :shared, after_change: nil) ⇒ Object
-
#float(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#hash(key, typed: :string, config: :shared, after_change: nil) ⇒ Object
-
#integer(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#json(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#list(key, typed: :string, config: :shared, after_change: nil) ⇒ Object
-
#proxy(key, config: :shared, after_change: nil) ⇒ Object
-
#scalar(key, typed: :string, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#set(key, typed: :string, config: :shared, after_change: nil) ⇒ Object
-
#slot(key, config: :shared, after_change: nil) ⇒ Object
-
#slots(key, available:, config: :shared, after_change: nil) ⇒ Object
-
#string(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
-
#unique_list(key, typed: :string, limit: nil, config: :shared, after_change: nil) ⇒ Object
Instance Method Details
#boolean(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
29
30
31
|
# File 'lib/kredis/types.rb', line 29
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, config: :shared, after_change: nil) ⇒ Object
42
43
44
|
# File 'lib/kredis/types.rb', line 42
def counter(key, expires_in: nil, config: :shared, after_change: nil)
type_from(Counter, config, key, after_change: after_change, expires_in: expires_in)
end
|
#cycle(key, values:, expires_in: nil, config: :shared, after_change: nil) ⇒ Object
46
47
48
|
# File 'lib/kredis/types.rb', line 46
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
33
34
35
|
# File 'lib/kredis/types.rb', line 33
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
21
22
23
|
# File 'lib/kredis/types.rb', line 21
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
54
55
56
|
# File 'lib/kredis/types.rb', line 54
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, config: :shared, after_change: nil) ⇒ Object
50
51
52
|
# File 'lib/kredis/types.rb', line 50
def flag(key, config: :shared, after_change: nil)
type_from(Flag, config, key, after_change: after_change)
end
|
#float(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
25
26
27
|
# File 'lib/kredis/types.rb', line 25
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, config: :shared, after_change: nil) ⇒ Object
58
59
60
|
# File 'lib/kredis/types.rb', line 58
def hash(key, typed: :string, config: :shared, after_change: nil)
type_from(Hash, config, key, after_change: after_change, typed: typed)
end
|
#integer(key, default: nil, config: :shared, after_change: nil, expires_in: nil) ⇒ Object
17
18
19
|
# File 'lib/kredis/types.rb', line 17
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
37
38
39
|
# File 'lib/kredis/types.rb', line 37
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
|
#list(key, typed: :string, config: :shared, after_change: nil) ⇒ Object
62
63
64
|
# File 'lib/kredis/types.rb', line 62
def list(key, typed: :string, config: :shared, after_change: nil)
type_from(List, config, key, after_change: after_change, typed: typed)
end
|
#proxy(key, config: :shared, after_change: nil) ⇒ Object
4
5
6
|
# File 'lib/kredis/types.rb', line 4
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
9
10
11
|
# File 'lib/kredis/types.rb', line 9
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, typed: :string, config: :shared, after_change: nil) ⇒ Object
70
71
72
|
# File 'lib/kredis/types.rb', line 70
def set(key, typed: :string, config: :shared, after_change: nil)
type_from(Set, config, key, after_change: after_change, typed: typed)
end
|
#slot(key, config: :shared, after_change: nil) ⇒ Object
74
75
76
|
# File 'lib/kredis/types.rb', line 74
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
78
79
80
|
# File 'lib/kredis/types.rb', line 78
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
13
14
15
|
# File 'lib/kredis/types.rb', line 13
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, typed: :string, limit: nil, config: :shared, after_change: nil) ⇒ Object
66
67
68
|
# File 'lib/kredis/types.rb', line 66
def unique_list(key, typed: :string, limit: nil, config: :shared, after_change: nil)
type_from(UniqueList, config, key, after_change: after_change, typed: typed, limit: limit)
end
|