app_cache 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dd4e6ce99fa3d65fdb62fb611d71371e6e1727d
4
- data.tar.gz: bd48e3180f35f8becc855e71e5a4825b8306d56f
3
+ metadata.gz: 7c682930ceff7fd391f2293f17cf2c8625816f5a
4
+ data.tar.gz: b8a9d7c1c377e62ac15493e6c714f469af892eff
5
5
  SHA512:
6
- metadata.gz: 08d0a541e911f558712902c3aab50a5cb66aca6640d48ee2e9269f755e58ccc8fc0c8627a348b0e6facb73524d9f87d5f69457a463fc6df54e8d46b6fa58f079
7
- data.tar.gz: 7b1ff66bfacbb378cb4e982c67480b5c1bc74526daf0da375b0dfa4fbe43beb15ebe83b6afaf93df385b1e5d892ee703093929be46e72d6f8f720cf47f2601fe
6
+ metadata.gz: ee1517222450b825e6f65b3cfd2d9df9f0d9d6acee8695912adcaa6e56335699247bf88fbf8057cbaaa6f31066a514b685ceee07147fd014defa765c4a68c7d9
7
+ data.tar.gz: 528250203701f7574c3e3bfed8e10143b9cbe726836c7fe60512f460e8c449970bb6829a87d2d1e4a4351a32958ef2f4ccdd2e4c57673783b4cd0bc848567c66
data/README.md CHANGED
@@ -24,6 +24,14 @@ Or install it yourself as:
24
24
 
25
25
  TODO: Write usage instructions here
26
26
 
27
+ ## Generate & Migrate
28
+ ```ruby
29
+ #Generate
30
+ rails g app_cache:migration
31
+ #migration
32
+ rake db:migrate
33
+ ```
34
+
27
35
  ## Development
28
36
 
29
37
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -31,8 +31,24 @@ module AppCache
31
31
  return h
32
32
  end
33
33
 
34
+ def self.get_params_db
35
+ h = {}
36
+ AppCache::SystemParam.all.each do |sp|
37
+ h.store(sp.param_code, sp.param_value)
38
+ end
39
+ h
40
+ end
41
+
42
+ def self.get_params
43
+ if AppCache.storage
44
+ self.get_params_cache
45
+ else
46
+ self.get_params_db
47
+ end
48
+ end
49
+
34
50
  def self.get_param_value(key)
35
- params = self.get_params_cache
51
+ params = self.get_params
36
52
  param_val = params[key] || ''
37
53
  param_val
38
54
  end
data/app_cache.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Terry"]
10
10
  spec.email = ["tuminfei1981@gmail.com"]
11
11
 
12
- spec.summary = %q{App System params cache in file.}
13
- spec.description = %q{App System params cache in file.}
12
+ spec.summary = %q{App System params cache in file or redis.}
13
+ spec.description = %q{App System params cache in file or redis.}
14
14
  spec.homepage = "https://github.com/tuminfei/app_cache"
15
15
  spec.license = "MIT"
16
16
 
@@ -1,3 +1,3 @@
1
1
  module AppCache
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/app_cache.rb CHANGED
@@ -27,11 +27,13 @@ module AppCache
27
27
  end
28
28
 
29
29
  def sys_params_db
30
- h = {}
31
- AppCache::SystemParam.all.each do |sp|
32
- h.store(sp.param_code, sp.param_value)
33
- end
34
- return h
30
+ h_params = AppCache::SystemParam.get_params_db
31
+ h_params
32
+ end
33
+
34
+ def get_params
35
+ vals = AppCache::SystemParam.get_params
36
+ vals
35
37
  end
36
38
 
37
39
  def get_param_value(key)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-23 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5.0'
83
- description: App System params cache in file.
83
+ description: App System params cache in file or redis.
84
84
  email:
85
85
  - tuminfei1981@gmail.com
86
86
  executables: []
@@ -130,5 +130,5 @@ rubyforge_project:
130
130
  rubygems_version: 2.6.12
131
131
  signing_key:
132
132
  specification_version: 4
133
- summary: App System params cache in file.
133
+ summary: App System params cache in file or redis.
134
134
  test_files: []