Created
February 2, 2021 18:56
-
-
Save jeromedalbert/57d47250588151279cf2dcceea8aed50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TmpSettings | |
module_function | |
def get(user:, setting:) | |
return nil if !user | |
$redis.get("tmp_settings:#{setting}:#{user.id}") | |
end | |
def set(user:, setting:, value:) | |
return if !user | |
$redis.set("tmp_settings:#{setting}:#{user.id}", value, ex: 1.week.to_i) | |
end | |
def delete(setting:, user:) | |
return if !user | |
$redis.del("tmp_settings:#{setting}:#{user.id}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment