Class: EMISRedis::Model

Inherits:
Common::RedisStore show all
Includes:
Common::CacheAside
Defined in:
app/models/emis_redis/model.rb

Overview

Generic model for caching EMIS data in Redis

Constant Summary

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Common::CacheAside

#cache, #cached?, #do_cached_with

Methods inherited from Common::RedisStore

create, delete, #destroy, #destroyed?, exists?, #expire, find, find_or_build, #initialize, #initialize_dup, keys, #persisted?, pop, redis_key, redis_store, redis_ttl, #save, #save!, #ttl, #update, #update!

Constructor Details

This class inherits a constructor from Common::RedisStore

Instance Attribute Details

#userObject

Returns the value of attribute user.



12
13
14
# File 'app/models/emis_redis/model.rb', line 12

def user
  @user
end

Class Method Details

.for_user(user) ⇒ EMISRedis::Model

Returns A new EMISRedis::Model for fetching the passed in user’s EMIS data.

Parameters:

  • user (User)

    User object

Returns:

  • (EMISRedis::Model)

    A new EMISRedis::Model for fetching the passed in user’s EMIS data



17
18
19
20
21
22
23
# File 'app/models/emis_redis/model.rb', line 17

def self.for_user(user)
  redis_config_key(:emis_response)

  emis_model = new
  emis_model.user = user
  emis_model
end