Created
June 3, 2017 01:33
-
-
Save mkhuda/b1a71ed756321461bc74a5e04db2c1fe to your computer and use it in GitHub Desktop.
Redis MULTI and HSET on Rails
This file contains hidden or 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 RedisProjectHelper | |
| # set hash | |
| def set_project!(sample_store_id, sample_store_name) | |
| $redis.multi do | |
| $redis.hset(self.redis_new_project_key(), 'sample_id', sample_store_id) | |
| $redis.hset(self.redis_new_project_key(), 'sample_name', sample_store_name) | |
| end | |
| end | |
| # set redis key | |
| def redis_new_project_key() | |
| "new_project:#{current_user.id}:data" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment