autobots 0.2.0 → 0.2.1

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: a5276029a0a189a4e7a067a5d47e7dbc5990eccd
4
- data.tar.gz: eb89fab64980725b4e2502ccf67d63b1afd12f46
3
+ metadata.gz: c09d3a52f075f9dbe81a701a194accac21f4f7af
4
+ data.tar.gz: 0c1733a2c3849202f8928b0b85f3b3420dcc3923
5
5
  SHA512:
6
- metadata.gz: 860b12863e969a7441f1f6afc87457cea2d48c5978f3ec7e9bd29d7e2e3e3f32a5ca08c7dcdf4e9389d32a775faf58179784e449519b126e779c5129e93719ca
7
- data.tar.gz: d8d7efc2073ad9562c71089d3d9404a7ed38295ec2e74de19ae8b8548b7942c539a6e426685284787a2d6cf690c3c5df57eb2d59d3b8d241850a46174feac35e
6
+ metadata.gz: 08f178e8886f9fd654e6852bd83fd9f11e46df46ac776378232e364ce5a3afa74063f36e5ff1ce2c20eb0214b118b8b79aa7942e77ce293d98d1f1d42a35ff1a
7
+ data.tar.gz: b62ee5b7c4390ac766ff35f3902ded5f757224dfb34cabe31d4c99fd2b2df7ce9f0770fb0917230ab75aaf85b71b3f82032f9dc56ff398dd6c3a17cfa11c2c82
data/README.md CHANGED
@@ -118,6 +118,13 @@ The default behavior of an assembler is to wrap each object with the declared se
118
118
 
119
119
  We can get large performance boosts by caching our serializable data. Caching is straight forward:
120
120
 
121
+ class ProjectAssembler < Autobots::Assembler
122
+ # some sort of ActiveSupport::CacheStore
123
+ self.cache = Rails.cache
124
+ end
125
+
126
+ Alternatively, you can set the cache on an instance:
127
+
121
128
  # some sort of ActiveSupport::CacheStore
122
129
  cache = Rails.cache
123
130
  assembler = ProjectAssembler.new(project_ids, cache: cache)
@@ -13,7 +13,7 @@ module Autobots
13
13
  class_attribute :cache
14
14
  end
15
15
  end
16
-
16
+
17
17
  def data
18
18
  return @data if defined?(@data)
19
19
 
@@ -38,8 +38,13 @@ module Autobots
38
38
 
39
39
  protected
40
40
 
41
+ def serializer_cache_key
42
+ return @serializer_cache_key if defined?(@serializer_cache_key)
43
+ @serializer_cache_key = [serializer.name, Digest::SHA256.hexdigest(serializer._attributes.keys.to_s)[0..12]]
44
+ end
45
+
41
46
  def cache_key(object, _)
42
- [object.cache_key, serializer.name, 'serializable-hash']
47
+ [object.cache_key, *self.serializer_cache_key, 'serializable-hash']
43
48
  end
44
49
  end
45
50
  end
@@ -1,3 +1,3 @@
1
1
  module Autobots
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bulk_cache_fetcher