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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e155d578c4af832b80e36763cc48c209e35c6b4b
4
- data.tar.gz: 634f81f73e24a11e88606c0287efd9e0bc961c5a
3
+ metadata.gz: 0fc27fd38df0dfbcf2cd6c18e2b4a8f4bbaabbf9
4
+ data.tar.gz: e19542b73f211061204750c22b48db633d723922
5
5
  SHA512:
6
- metadata.gz: e13fdaac7c3ec88a11b465385c3e659113a4f314a2a9a657d1cd5740b707c8750ea174645072137a2d3a4c02b63ed7a43747718de2c5e70cd5dd8f5a6df19cfe
7
- data.tar.gz: 144278a34bf14ae8a9b63d4c3d08ff7134ec4fbafff4c8bba68b494bc723581047ea3bb9293b9e83399fd85b1e443c23b1772c07506bf8ca30ebdf5423b3a188
6
+ metadata.gz: 3e9d3667e388f48fdd78d5267a3a0b50193f2578b284ce98bd5ddcc9f1c79f73d5310bd67546f94d16f9b4f4b5189c37165a682f9664b14e7007507ad42470ed
7
+ data.tar.gz: 8fa85e3983755e5a883ff60c0bfd213ed3ddd38bdc08458f34fa0787bf776eb77ce3e2dd94a3d8bbc42540f82bb18237e8a69e039b3da9daa1409d5252f74315
@@ -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 = PadmaAccount.find(account_name)
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
@@ -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.28
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: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties