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 +4 -4
- data/README.md +8 -0
- data/app/models/app_cache/system_param.rb +17 -1
- data/app_cache.gemspec +2 -2
- data/lib/app_cache/version.rb +1 -1
- data/lib/app_cache.rb +7 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c682930ceff7fd391f2293f17cf2c8625816f5a
|
4
|
+
data.tar.gz: b8a9d7c1c377e62ac15493e6c714f469af892eff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
|
data/lib/app_cache/version.rb
CHANGED
data/lib/app_cache.rb
CHANGED
@@ -27,11 +27,13 @@ module AppCache
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def sys_params_db
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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.
|
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-
|
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: []
|