accounts_client 0.2.28 → 0.2.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/padma_account.rb +4 -4
- data/app/models/padma_user.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc27fd38df0dfbcf2cd6c18e2b4a8f4bbaabbf9
|
4
|
+
data.tar.gz: e19542b73f211061204750c22b48db633d723922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e9d3667e388f48fdd78d5267a3a0b50193f2578b284ce98bd5ddcc9f1c79f73d5310bd67546f94d16f9b4f4b5189c37165a682f9664b14e7007507ad42470ed
|
7
|
+
data.tar.gz: 8fa85e3983755e5a883ff60c0bfd213ed3ddd38bdc08458f34fa0787bf776eb77ce3e2dd94a3d8bbc42540f82bb18237e8a69e039b3da9daa1409d5252f74315
|
data/app/models/padma_account.rb
CHANGED
@@ -73,12 +73,12 @@ class PadmaAccount < LogicalModel
|
|
73
73
|
res
|
74
74
|
end
|
75
75
|
|
76
|
-
def self.find_with_rails_cache(account_name)
|
76
|
+
def self.find_with_rails_cache(account_name,options={})
|
77
77
|
pa = Rails.cache.read([account_name,"padma_account"])
|
78
|
-
if pa.nil?
|
79
|
-
pa =
|
78
|
+
if pa.nil? || options[:refresh]
|
79
|
+
pa = find(account_name)
|
80
80
|
if pa
|
81
|
-
Rails.cache.write([account_name,"padma_account"], pa, :expires_in => 5.minutes)
|
81
|
+
Rails.cache.write([account_name,"padma_account"], pa, :expires_in => (options[:expires_in] || 5.minutes))
|
82
82
|
end
|
83
83
|
end
|
84
84
|
pa
|
data/app/models/padma_user.rb
CHANGED
@@ -31,6 +31,16 @@ class PadmaUser < LogicalModel
|
|
31
31
|
TIMEOUT = 5500 # milisecons
|
32
32
|
PER_PAGE = 9999
|
33
33
|
|
34
|
+
def self.find_with_rails_cache(username,options = {})
|
35
|
+
pu = Rails.cache.read([username,"padma_user"])
|
36
|
+
if pu.nil? || options[:refresh]
|
37
|
+
pu = find(username)
|
38
|
+
if pu
|
39
|
+
Rails.cache.write([username,"padma_user"], pu, :expires_in => (options[:expires_in] || 5.minutes))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
pu
|
43
|
+
end
|
34
44
|
|
35
45
|
# @return [PadmaAccount]
|
36
46
|
def current_account
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accounts_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dwayne Macgowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|