Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def set_to_redis
- $redis.mapped_hmset( redis_key, self.attributes )
- end
- def destroy_in_redis
- $redis.del redis_key
- end
- def self.find_in_redis(id)
- if $redis.hgetall "Post:#{id}".nil?
- post = Post.find(id)
- $redis.mapped_hmset( "Post:#{id}", post.attributes )
- $redis.hgetall "Post:#{id}"
- else
- $redis.hgetall "Post:#{id}"
- end
- ##WORK BUT will be rewrite !!! MPORTANT
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement