Module: AppCache

Defined in:
lib/app_cache.rb,
lib/app_cache/engine.rb,
lib/app_cache/railtie.rb,
lib/app_cache/version.rb,
lib/app_cache/local_file_cache.rb,
app/models/app_cache/system_param.rb

Defined Under Namespace

Classes: Engine, LocalFileCache, MigrationGenerator, Railtie, SystemParam

Constant Summary collapse

CACHE_TYPE_REDIS =
'redis'
CACHE_TYPE_FILE =
'file'
VERSION =
"0.1.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.storageObject

Returns the value of attribute storage.



11
12
13
# File 'lib/app_cache.rb', line 11

def storage
  @storage
end

Class Method Details

.get_level_params(level_id) ⇒ Object



39
40
41
42
# File 'lib/app_cache.rb', line 39

def get_level_params(level_id)
  vals = AppCache::SystemParam.get_level_params(level_id)
  vals
end

.get_param_value(key) ⇒ Object



44
45
46
47
# File 'lib/app_cache.rb', line 44

def get_param_value(key)
  val = AppCache::SystemParam.get_param_value(key)
  val
end

.get_paramsObject



34
35
36
37
# File 'lib/app_cache.rb', line 34

def get_params
  vals = AppCache::SystemParam.get_params
  vals
end

.new(cache_type, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/app_cache.rb', line 13

def new(cache_type, options = {})
  case cache_type
    when CACHE_TYPE_REDIS
      @storage = Redis.new(:url => options[:url])
    else
      @storage = AppCache::LocalFileCache.new(options[:file_path])
  end
  #更新缓存
  AppCache::SystemParam.cache_update
end

.sys_params_cacheObject



24
25
26
27
# File 'lib/app_cache.rb', line 24

def sys_params_cache
  h_params = AppCache::SystemParam.get_params_cache
  h_params
end

.sys_params_dbObject



29
30
31
32
# File 'lib/app_cache.rb', line 29

def sys_params_db
  h_params = AppCache::SystemParam.get_params_db
  h_params
end