Sha256: 2fc9e53e3364dee8f1bd6f0ce618547c501506719519ce75626687390d6273b5

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 Bytes

Contents

require 'app_cache/version'
require 'app_cache/engine'
require 'app_cache/local_file_cache'
require "app_cache/railtie" if defined?(Rails)

module AppCache
  CACHE_TYPE_REDIS = 'redis'
  CACHE_TYPE_FILE = 'file'

  class << self
    attr_accessor :storage

    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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_cache-0.1.1 lib/app_cache.rb