Skip to content

Commit 7b90152

Browse files
committed
Add example in Readme.md
1 parent e89b2d8 commit 7b90152

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,16 @@ You can use all these structures in models:
168168
```ruby
169169
class Person < ApplicationRecord
170170
kredis_list :names
171-
kredis_list :names_with_custom_key, key: ->(p) { "person:#{p.id}:names_customized" }
171+
kredis_list :names_with_custom_key_via_lambda, key: ->(p) { "person:#{p.id}:names_customized" }
172+
kredis_list :names_with_custom_key_via_method, key: :generate_names_key
172173
kredis_unique_list :skills, limit: 2
173174
kredis_enum :morning, values: %w[ bright blue black ], default: "bright"
174175
kredis_counter :steps, expires_in: 1.hour
176+
177+
private
178+
def generate_names_key
179+
"key-generated-from-private-method"
180+
end
175181
end
176182

177183
person = Person.find(5)

0 commit comments

Comments
 (0)