Sha256: dd36fa4ce58244445d35f05b791f0390b6986a4c738dd18d0c94eb6b722c4e48
Contents?: true
Size: 702 Bytes
Versions: 3
Compression:
Stored size: 702 Bytes
Contents
module UserSettings class Key class << self def create_or_update(user_id, key, value = nil) UserSettings.redis.setex redisable_key(user_id, key), UserSettings.expiration_time, value end def create(user_id, key, value) if find(user_id, key) false else create_or_update(user_id, key, value) end end def find(user_id, key) UserSettings.redis.get redisable_key(user_id, key) end def destroy(user_id, key) UserSettings.redis.del redisable_key(user_id, key) end private def redisable_key(user_id, key) "usersetting:#{user_id}:#{key}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
user_settings-0.0.3 | app/models/user_settings/key.rb |
user_settings-0.0.2 | app/models/user_settings/key.rb |
user_settings-0.0.1 | app/models/user_settings/key.rb |